@@ -58,7 +58,7 @@ def test_valid_values_on_postings(src_value, set_value):
checker = meta_tax_implication.MetaTaxImplication()
errors = list(checker.run(txn))
assert not errors
assert txn.postings[-1].meta.get(TEST_KEY) == set_value
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
@pytest.mark.parametrize('src_value', INVALID_VALUES)
def test_invalid_values_on_postings(src_value):
@@ -69,6 +69,7 @@ def test_invalid_values_on_postings(src_value):
assert errors
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
def test_valid_values_on_transactions(src_value, set_value):
@@ -79,7 +80,7 @@ def test_valid_values_on_transactions(src_value, set_value):
def test_invalid_values_on_transactions(src_value):
@@ -90,6 +91,7 @@ def test_invalid_values_on_transactions(src_value):
testutil.check_post_meta(txn, None, None)
@pytest.mark.parametrize('account', [
'Accrued:AccountsPayable',
@@ -97,13 +99,15 @@ def test_invalid_values_on_transactions(src_value):
'Liabilities:CreditCard',
])
def test_non_asset_accounts_skipped(account):
meta = {TEST_KEY: 'USA-Corporation'}
txn = testutil.Transaction(postings=[
(account, 25),
('Assets:Cash', -25, {TEST_KEY: 'USA-Corporation'}),
('Assets:Cash', -25, meta.copy()),
testutil.check_post_meta(txn, None, meta)
def test_asset_credits_skipped():
@@ -113,7 +117,7 @@ def test_asset_credits_skipped():
assert not txn.postings[-1].meta
@pytest.mark.parametrize('date,need_value', [
(testutil.EXTREME_FUTURE_DATE, False),
@@ -122,7 +126,7 @@ def test_asset_credits_skipped():
(testutil.FY_MID_DATE, True),
(testutil.PAST_DATE, False),
def test_default_value_set_in_date_range(date, need_value):
def test_validation_only_in_date_range(date, need_value):
txn = testutil.Transaction(date=date, postings=[
('Liabilites:CreditCard', 25),
('Assets:Cash', -25),
@@ -130,3 +134,4 @@ def test_default_value_set_in_date_range(date, need_value):
assert bool(errors) == bool(need_value)