def test_task5_module5(): found_timeit_call = False calls = utils.get_calls(ExpenseCategories) expected_timeit_str = 'print:timeit:timeit:stmt:expenses.categorize_set_comprehension():setup:\n from . import Expense\nexpenses = Expense.Expenses()\nexpenses.read_expenses(\'data/spending_data.csv\')\n:number:100000:globals:globals' for x in calls: if expected_timeit_str.replace(" ", "") in x.replace(" ", ""): found_timeit_call = True message = 'Did you copy and paste the entire `print(timeit.timeit(...))` from the previous task and replace the `stmt` with `expenses.categorize_set_comprehension()`?' assert found_timeit_call, message
def test_task4_module5(): found_timeit_call = False calls = utils.get_calls(ExpenseCategories) expected_timeit_str = 'print:timeit:timeit:stmt:expenses.categorize_for_loop():setup:\n from . import Expense\nexpenses = Expense.Expenses()\nexpenses.read_expenses(\'data/spending_data.csv\')\n:number:100000:globals:globals' for x in calls: if expected_timeit_str.replace(" ", "") in x.replace(" ", ""): found_timeit_call = True message = 'Did you wrap the `timeit.timeit()` call with `print()`?' assert found_timeit_call, message
def test_task3_module5(): found_timeit_call = False calls = utils.get_calls(ExpenseCategories) print("calls = " + str(calls)) expected_timeit_str = 'timeit:timeit:stmt:expenses.categorize_for_loop():setup:\n from . import Expense\nexpenses = Expense.Expenses()\nexpenses.read_expenses(\'data/spending_data.csv\')\n:number:100000:globals:globals' for x in calls: if expected_timeit_str.replace(" ", "") in x.replace(" ", ""): found_timeit_call = True message = 'Did you call `timeit.timeit()` and replace `stmt` and `setup` with the correct code?' assert found_timeit_call, message