diff --git a/tests/test_meta_entity.py b/tests/test_meta_entity.py index dd5c7121745c32db08c9490edabd9c1d9beb42bd..f8b012238e5c8e0ac8404c8df1e46fc693f24a59 100644 --- a/tests/test_meta_entity.py +++ b/tests/test_meta_entity.py @@ -214,6 +214,16 @@ def test_which_accounts_required_on(hook, account, required): assert any(error.message == "{} missing entity".format(account) for error in errors) +def test_dont_set_entity_none(hook): + txn = testutil.Transaction(postings=[ + ('Expenses:Other', 5), + ('Assets:Cash', -5), + ]) + assert any(hook.run(txn)) + assert 'entity' not in txn.meta + for post in txn.postings: + assert post.meta is None or 'entity' not in post.meta + def test_not_required_on_opening(hook): txn = testutil.OpeningBalance() assert not list(hook.run(txn))