tests: Test metadata deletion through iter_postings.
This commit is contained in:
parent
3a73bc2239
commit
e9096b9500
1 changed files with 6 additions and 1 deletions
|
@ -33,9 +33,14 @@ def test_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 post.meta['note'] # Only works with PostingMeta
|
assert post.meta['note'] # Only works with PostingMeta
|
||||||
|
|
||||||
def test_editing_metadata_edits_source(simple_txn):
|
def test_setting_metadata_propagates_to_source(simple_txn):
|
||||||
for index, post in enumerate(data.iter_postings(simple_txn)):
|
for index, post in enumerate(data.iter_postings(simple_txn)):
|
||||||
post.meta['edited'] = str(index)
|
post.meta['edited'] = str(index)
|
||||||
for index, post in enumerate(simple_txn.postings):
|
for index, post in enumerate(simple_txn.postings):
|
||||||
assert post.meta['edited'] == str(index)
|
assert post.meta['edited'] == str(index)
|
||||||
assert not isinstance(post.meta, data.PostingMeta)
|
assert not isinstance(post.meta, data.PostingMeta)
|
||||||
|
|
||||||
|
def test_deleting_metadata_propagates_to_source(simple_txn):
|
||||||
|
posts = list(data.iter_postings(simple_txn))
|
||||||
|
del posts[1].meta['extra']
|
||||||
|
assert 'extra' not in simple_txn.postings[1].meta
|
||||||
|
|
Loading…
Reference in a new issue