Changeset - e9096b95002a
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-03-17 21:47:00
brettcsmith@brettcsmith.org
tests: Test metadata deletion through iter_postings.
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
tests/test_data_iter_postings.py
Show inline comments
...
 
@@ -33,9 +33,14 @@ def test_iter_postings(simple_txn):
 
        assert all(source[x] == post[x] for x in range(len(source) - 1))
 
        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)):
 
        post.meta['edited'] = str(index)
 
    for index, post in enumerate(simple_txn.postings):
 
        assert post.meta['edited'] == str(index)
 
        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
0 comments (0 inline, 0 general)