diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index 067fa393bcd60e80e7e7cef10eaa81cf961ec18a..bd64fc63c3edcebc09ac89c1dd69fbba944244b2 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -33,10 +33,15 @@ from conservancy_beancount.reports import accrual from conservancy_beancount.reports import core _accruals_load = bc_loader.load_file(testutil.test_path('books/accruals.beancount')) +ACCRUAL_TXNS = [ + entry for entry in _accruals_load[0] + if hasattr(entry, 'narration') + and entry.narration != 'Opening balances' +] ACCRUALS_COUNT = sum( 1 - for entry in _accruals_load[0] - for post in getattr(entry, 'postings', ()) + for txn in ACCRUAL_TXNS + for post in txn.postings if post.account.startswith(('Assets:Receivable:', 'Liabilities:Payable:')) ) @@ -74,14 +79,9 @@ class RTClient(testutil.RTClient): } -@pytest.fixture -def accrual_entries(): - return copy.deepcopy(_accruals_load[0]) - @pytest.fixture def accrual_postings(): - entries = copy.deepcopy(_accruals_load[0]) - return data.Posting.from_entries(entries) + return data.Posting.from_entries(copy.deepcopy(ACCRUAL_TXNS)) def check_link_regexp(regexp, match_s, first_link_only=False): assert regexp