expensedb#

class src.expensedb.ExpenseDatabase[source]#

Bases: object

Manages a collection of Expense objects

add_expense[source]#

Adds an expense to the database.

Parameters:

expense (Expense) – the expense to add to the database.

remove_expense[source]#

Removes an expense from the database.

Parameters:

expense_id (str) – A unique identifier for an expense.

get_expense_by_id[source]#

Retrieves an expense from the database by its unique identifier.

Parameters:

expense_id (str) – A unique identifier for an expense.

get_expense_by_title[source]#

Retrieves a list of expenses from the database by their title.

Parameters:

expense_title (str) – The title of the expense.

Returns:

A list of expenses with the given title.

Return type:

List

to_dict[source]#

Returns a list of dictionaries representing the expenses in the database.

Returns:

A list of dictionaries representing the expenses in the database.

Return type:

List[Dict]