Files
@ 5859421a15ce
Branch filter:
Location: NPO-Accounting/conservancy_beancount/tests/test_data_is_opening_balance_txn.py - annotation
5859421a15ce
2.1 KiB
text/x-python
accrual: Remove the consistency checker.
Everything it said was a problem has been done legitimately in our books at
one point or another.
* Variation in contract can happen in different line items of an invoice or
"group of contractor" situations.
* Variation in cost can happen because one invoice spans a period of time,
like donation matching programs. There is probably still value in a tool
that checks to make sure we use consistent rates each day, but that
affects all kinds of transactions, not just accruals, so it would be
done better in a separate tool.
* Variation in account happens because invoices legitimately span accrual
accounts, like donation matching programs with fees payable.
So: it's gone, good riddance.
Everything it said was a problem has been done legitimately in our books at
one point or another.
* Variation in contract can happen in different line items of an invoice or
"group of contractor" situations.
* Variation in cost can happen because one invoice spans a period of time,
like donation matching programs. There is probably still value in a tool
that checks to make sure we use consistent rates each day, but that
affects all kinds of transactions, not just accruals, so it would be
done better in a separate tool.
* Variation in account happens because invoices legitimately span accrual
accounts, like donation matching programs with fees payable.
So: it's gone, good riddance.
4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 701ccdc19250 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 701ccdc19250 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 4eaba1ebf645 | """Test data.is_opening_balance_txn function"""
# Copyright © 2020 Brett Smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from decimal import Decimal
import pytest
from . import testutil
from conservancy_beancount import data
def test_typical_opening():
txn = testutil.OpeningBalance()
assert data.is_opening_balance_txn(txn)
def test_multiacct_opening():
txn = testutil.Transaction(postings=[
('Assets:Receivable:Accounts', 100),
(next(testutil.OPENING_EQUITY_ACCOUNTS), -100),
('Liabilities:Payable:Accounts', -150),
(next(testutil.OPENING_EQUITY_ACCOUNTS), 150),
])
assert data.is_opening_balance_txn(txn)
def test_opening_with_fx():
txn = testutil.OpeningBalance()
equity_post = txn.postings[-1]
txn.postings[-1] = equity_post._replace(
units=testutil.Amount(equity_post.units.number * Decimal('.9'), 'EUR'),
cost=testutil.Cost('1.11111'),
)
assert data.is_opening_balance_txn(txn)
@pytest.mark.parametrize('acct1,acct2,number', [
('Assets:Receivable:Accounts', 'Income:Donations', 100),
('Expenses:Other', 'Liabilities:Payable:Accounts', 200),
('Expenses:Other', 'Equity:Retained:Costs', 300),
# Release from restriction
('Equity:Funds:Unrestricted', 'Equity:Funds:Restricted', 400),
])
def test_not_opening_balance(acct1, acct2, number):
txn = testutil.Transaction(postings=[
(acct1, number),
(acct2, -number),
])
assert not data.is_opening_balance_txn(txn)
|