Esempio n. 1
0
def test_task9_module4():
    fors = utils.get_for_loops(ExpenseCategories)
    print("fors = " + str(fors))

    for_str = 'a:b:zip:divided_for_loop:divided_set_comp:a:issubset:b:b:issubset:a:print:Sets are NOT equal by subset test'
    message = 'Did you create an `for` loop that uses `a,b` as iterator variables to iterate `zip(divided_for_loop, divided_set_comp)`?'
    assert for_str in fors, message
Esempio n. 2
0
def test_task8_module4():
    fors = utils.get_for_loops(ExpenseCategories)
    print("fors = " + str(fors))
    for_loop_found = False
    for x in fors:
        if 'a:b:zip:divided_for_loop:divided_set_comp' in x:
            for_loop_found = True

    message = 'Did you create an `for` loop that uses `a,b` as iterator variables to iterate `zip(divided_for_loop, divided_set_comp)`?'
    assert for_loop_found, message
Esempio n. 3
0
def test_task9_module5():
    fors = utils.get_for_loops(ExpenseCategories)
    found_for_loop = False

    for x in fors:
        if 'category_exps:divided_set_comp' in x:
            found_for_loop = True

    for_str = 'category_exps:divided_set_comp:divided_expenses_sum:append:sum:x:amount:x:category_exps:0'
    assert found_for_loop, 'Did you create a `for` loop that has an iterator called `category_exps` and loops through `divided_set_comp`?'
    assert for_str in fors, 'Inside the for loop, did you call `divided_expenses_sum.append()`, with `x.amount for x in category_exps` as the argument?'