@@ -57,7 +57,7 @@ def hook():
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
def test_valid_values_on_postings(hook, src_value, set_value):
txn = testutil.Transaction(postings=[
('Accrued:AccountsPayable', 25),
('Liabilities:Payable:Accounts', 25),
('Assets:Cash', -25, {TEST_KEY: src_value}),
])
errors = list(hook.run(txn))
@@ -67,7 +67,7 @@ def test_valid_values_on_postings(hook, src_value, set_value):
@pytest.mark.parametrize('src_value', INVALID_VALUES)
def test_invalid_values_on_postings(hook, src_value):
@@ -77,7 +77,7 @@ def test_invalid_values_on_postings(hook, src_value):
def test_valid_values_on_transactions(hook, src_value, set_value):
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
('Assets:Cash', -25),
@@ -87,37 +87,34 @@ def test_valid_values_on_transactions(hook, src_value, set_value):
def test_invalid_values_on_transactions(hook, src_value):
assert errors
testutil.check_post_meta(txn, None, None)
@pytest.mark.parametrize('account', [
'Accrued:AccountsPayable',
'Expenses:General',
@pytest.mark.parametrize('count,account', enumerate([
'Assets:Payable:Accounts',
'Assets:Prepaid:Expenses',
'Equity:OpeningBalance',
'Expenses:Other',
'Income:Other',
'Liabilities:CreditCard',
def test_non_asset_accounts_skipped(hook, account):
'Liabilities:Payable:Accounts',
'Liabilities:UnearnedIncome:Donations',
], 1))
def test_non_payment_accounts_skipped(hook, account, count):
amount = count * 100
meta = {TEST_KEY: 'USA-Corporation'}
(account, 25),
('Assets:Cash', -25, meta.copy()),
(account, amount),
('Assets:Checking', -amount, meta.copy()),
assert not errors
testutil.check_post_meta(txn, None, meta)
def test_prepaid_expenses_skipped(hook, ):
('Expenses:General', 25),
('Assets:PrepaidExpenses', -25),
def test_asset_credits_skipped(hook, ):
('Income:Donations', -25),