File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
tests/test_loaders_dumpers Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ def test_yaml_dumper(self):
2929 # test contents of yaml file with cleaned dict made from bookseries instance in setup
3030 with open (self .env .input_path ('book_series_lotr.yaml' ), 'r' ) as f :
3131 data = yaml .safe_load (f )
32+ # explicitly confirm that unset fields aren't written to the file
33+ for i in range (3 ):
34+ 'genres' not in data ['books' ][i ].keys ()
35+ 'inStock' not in data ['books' ][i ].keys ()
36+ 'creator' not in data ['books' ][i ].keys ()
3237 self .assertEqual (data , remove_empty_items (self .bookseries .dict ()))
3338
3439
@@ -40,4 +45,9 @@ def test_json_dumper(self):
4045 # test contents of json file with cleaned dict made from bookseries instance in setup
4146 with open (self .env .input_path ('book_series_lotr.json' ), 'r' ) as f :
4247 data = json .load (f )
48+ # explicitly confirm that unset fields aren't written to the file
49+ for i in range (3 ):
50+ 'genres' not in data ['books' ][i ].keys ()
51+ 'inStock' not in data ['books' ][i ].keys ()
52+ 'creator' not in data ['books' ][i ].keys ()
4353 self .assertEqual (data , remove_empty_items (self .bookseries .dict ()))
You can’t perform that action at this time.
0 commit comments