diff --git a/tests/test_meta_expenseAllocation.py b/tests/test_meta_expenseAllocation.py index 34d9dd86675cf2b56475af1d2c23a38ef5ea4c10..b5578f13459174d332a7abb26e5c0127031d4afd 100644 --- a/tests/test_meta_expenseAllocation.py +++ b/tests/test_meta_expenseAllocation.py @@ -109,3 +109,21 @@ def test_default_values(account, set_value): errors = checker.check(txn, txn.postings[-1]) assert not errors assert txn.postings[-1].meta['expenseAllocation'] == set_value + +@pytest.mark.parametrize('date,set_value', [ + (testutil.EXTREME_FUTURE_DATE, False), + (testutil.FUTURE_DATE, True), + (testutil.FY_START_DATE, True), + (testutil.FY_MID_DATE, True), + (testutil.PAST_DATE, False), +]) +def test_default_value_set_in_date_range(date, set_value): + txn = testutil.Transaction(date=date, postings=[ + ('Liabilites:CreditCard', -25), + ('Expenses:General', 25), + ]) + checker = meta_expense_allocation.MetaExpenseAllocation() + errors = checker.check(txn, txn.postings[-1]) + assert not errors + got_value = (txn.postings[-1].meta or {}).get('expenseAllocation') + assert bool(got_value) == bool(set_value)