data: iter_postings uses Account.
This commit is contained in:
parent
6c0f23b2fa
commit
163ecbc7d3
2 changed files with 2 additions and 0 deletions
|
@ -86,5 +86,6 @@ class PostingMeta(collections.abc.MutableMapping):
|
||||||
def iter_postings(txn: Transaction) -> Iterator[Posting]:
|
def iter_postings(txn: Transaction) -> Iterator[Posting]:
|
||||||
for index, source in enumerate(txn.postings):
|
for index, source in enumerate(txn.postings):
|
||||||
yield source._replace(
|
yield source._replace(
|
||||||
|
account=Account(source.account),
|
||||||
meta=PostingMeta(txn, index, source),
|
meta=PostingMeta(txn, index, source),
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,6 +30,7 @@ def simple_txn(index=None, key=None):
|
||||||
def test_iter_postings(simple_txn):
|
def test_iter_postings(simple_txn):
|
||||||
for source, post in zip(simple_txn.postings, data.iter_postings(simple_txn)):
|
for source, post in zip(simple_txn.postings, data.iter_postings(simple_txn)):
|
||||||
assert all(source[x] == post[x] for x in range(len(source) - 1))
|
assert all(source[x] == post[x] for x in range(len(source) - 1))
|
||||||
|
assert isinstance(post.account, data.Account)
|
||||||
assert post.meta['note'] # Only works with PostingMeta
|
assert post.meta['note'] # Only works with PostingMeta
|
||||||
|
|
||||||
def test_setting_metadata_propagates_to_source(simple_txn):
|
def test_setting_metadata_propagates_to_source(simple_txn):
|
||||||
|
|
Loading…
Reference in a new issue