Files
@ 5859421a15ce
Branch filter:
Location: NPO-Accounting/conservancy_beancount/tests/test_data_metadata.py - annotation
5859421a15ce
1.8 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.
9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 f99613907036 f99613907036 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 9b63d898af70 | """Test Metadata class"""
# 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/>.
import pytest
from . import testutil
from conservancy_beancount import data
@pytest.fixture
def simple_txn(index=None, key=None):
return testutil.Transaction(note='txn note', postings=[
('Assets:Cash', 5),
('Income:Donations', -5, {'note': 'donation love', 'extra': 'Extra'}),
])
SIMPLE_TXN_METAKEYS = frozenset(['filename', 'lineno', 'note'])
def test_metadata_transforms_source():
source = {'1': 'one'}
meta = data.Metadata(source)
meta['2'] = 'two'
assert source['2'] == 'two'
del meta['1']
assert set(source) == {'2'}
@pytest.mark.parametrize('value', [
'',
'link',
' link',
'link ',
'link1 link2',
' link1 link2 link3 ',
])
def test_get_links(value):
meta = data.Metadata({'key': value})
assert list(meta.get_links('key')) == value.split()
def test_get_links_missing():
meta = data.Metadata({})
assert not meta.get_links('key')
@pytest.mark.parametrize('value', testutil.NON_STRING_METADATA_VALUES)
def test_get_links_bad_type(value):
meta = data.Metadata({'key': value})
with pytest.raises(TypeError):
meta.get_links('key')
|