Changeset - 3f9e67de3ac5
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-03-18 13:00:47
brettcsmith@brettcsmith.org
meta_tax_implication: Don't enforce on Assets:PrepaidExpenses.
2 files changed with 11 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_tax_implication.py
Show inline comments
...
 
@@ -38,16 +38,16 @@ class MetaTaxImplication(core._NormalizePostingMetadataHook):
 
        'Refund',
 
        'Reimbursement',
 
        'Retirement-Pretax',
 
        'Tax-Payment',
 
        'USA-501c3',
 
        'USA-Corporation',
 
        'USA-LLC-No-1099',
 
        'W2',
 
    ], {})
 

	
 
    def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
 
        return bool(
 
            post.account.startswith('Assets:')
 
            post.account.is_real_asset()
 
            and post.units.number
 
            and post.units.number < DEFAULT_STOP_AMOUNT
 
        )
tests/test_meta_tax_implication.py
Show inline comments
...
 
@@ -100,24 +100,34 @@ def test_invalid_values_on_transactions(src_value):
 
])
 
def test_non_asset_accounts_skipped(account):
 
    meta = {TEST_KEY: 'USA-Corporation'}
 
    txn = testutil.Transaction(postings=[
 
        (account, 25),
 
        ('Assets:Cash', -25, meta.copy()),
 
    ])
 
    checker = meta_tax_implication.MetaTaxImplication()
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    testutil.check_post_meta(txn, None, meta)
 

	
 
def test_prepaid_expenses_skipped():
 
    txn = testutil.Transaction(postings=[
 
        ('Expenses:General', 25),
 
        ('Assets:PrepaidExpenses', -25),
 
    ])
 
    checker = meta_tax_implication.MetaTaxImplication()
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    testutil.check_post_meta(txn, None, None)
 

	
 
def test_asset_credits_skipped():
 
    txn = testutil.Transaction(postings=[
 
        ('Income:Donations', -25),
 
        ('Assets:Cash', 25),
 
    ])
 
    checker = meta_tax_implication.MetaTaxImplication()
 
    errors = list(checker.run(txn))
 
    assert not errors
 
    testutil.check_post_meta(txn, None, None)
 

	
 
@pytest.mark.parametrize('date,need_value', [
 
    (testutil.EXTREME_FUTURE_DATE, False),
0 comments (0 inline, 0 general)