File diff c9ff4ab74617 → a41feb94b3e0
tests/test_meta_expense_allocation.py
Show inline comments
...
 
@@ -44,7 +44,7 @@ def test_valid_values_on_postings(src_value, set_value):
 
        ('Expenses:General', 25, {TEST_KEY: src_value}),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    assert txn.postings[-1].meta.get(TEST_KEY) == set_value
 

	
...
 
@@ -55,7 +55,7 @@ def test_invalid_values_on_postings(src_value):
 
        ('Expenses:General', 25, {TEST_KEY: src_value}),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert errors
 

	
 
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
...
 
@@ -65,7 +65,7 @@ def test_valid_values_on_transactions(src_value, set_value):
 
        ('Expenses:General', 25),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    assert txn.postings[-1].meta.get(TEST_KEY) == set_value
 

	
...
 
@@ -76,7 +76,7 @@ def test_invalid_values_on_transactions(src_value):
 
        ('Expenses:General', 25),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert errors
 

	
 
@pytest.mark.parametrize('account', [
...
 
@@ -92,7 +92,7 @@ def test_non_expense_accounts_skipped(account):
 
        ('Expenses:General', 25, {TEST_KEY: 'program'}),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[0], 0)
 
    errors = list(checker.run(txn))
 
    assert not errors
 

	
 
@pytest.mark.parametrize('account,set_value', [
...
 
@@ -108,7 +108,7 @@ def test_default_values(account, set_value):
 
        (account, 25),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    assert txn.postings[-1].meta[TEST_KEY] == set_value
 

	
...
 
@@ -125,7 +125,7 @@ def test_default_value_set_in_date_range(date, set_value):
 
        ('Expenses:General', 25),
 
    ])
 
    checker = meta_expense_allocation.MetaExpenseAllocation()
 
    errors = checker.run(txn, txn.postings[-1], -1)
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    got_value = (txn.postings[-1].meta or {}).get(TEST_KEY)
 
    assert bool(got_value) == bool(set_value)