@@ -253,13 +253,13 @@ def test_all_meta_links_zero(count):
for n in range(count)
)
related = core.RelatedPostings(
post._replace(meta=data.Metadata(post.meta))
for post in postings
assert related.all_meta_links('approval') == set()
assert next(related.all_meta_links('approval'), None) is None
def test_all_meta_links_singletons():
postings = (
testutil.Posting('Income:Donations', -10, statement=value)
for value in itertools.chain(
testutil.NON_LINK_METADATA_STRINGS,
@@ -267,24 +267,35 @@ def test_all_meta_links_singletons():
testutil.NON_STRING_METADATA_VALUES,
))
assert related.all_meta_links('statement') == testutil.LINK_METADATA_STRINGS
assert set(related.all_meta_links('statement')) == testutil.LINK_METADATA_STRINGS
def test_all_meta_links_multiples():
testutil.Posting('Income:Donations', -10, approval=' '.join(value))
for value in itertools.permutations(testutil.LINK_METADATA_STRINGS, 2)
assert related.all_meta_links('approval') == testutil.LINK_METADATA_STRINGS
assert set(related.all_meta_links('approval')) == testutil.LINK_METADATA_STRINGS
def test_all_meta_links_preserves_order():
testutil.Posting('Income:Donations', -10, approval=c)
for c in '121323'
assert list(related.all_meta_links('approval')) == list('123')
def test_group_by_meta_zero():
assert not list(core.RelatedPostings.group_by_meta([], 'metacurrency'))
def test_group_by_meta_one(credit_card_cycle):
posting = next(post for post in data.Posting.from_entries(credit_card_cycle)