Commit 44c8c953 authored by abuddenberg's avatar abuddenberg
Browse files

Updated test suite to check for incorrect merge behavior

parent 8dc4e8c1
......@@ -37,7 +37,7 @@ def test_domain_as_json():
assert f.original['images'] not in (None, '')
assert f.original['uri'] not in (None, '')
#Make sured fields specifically
#Make sure fields specifically omitted are actually omitted
fig_json_out = json.loads(f.as_json())
assert all([omitted_key not in fig_json_out for omitted_key in ['chapter', 'images', 'uri', 'href']])
......@@ -49,6 +49,17 @@ def test_domain_as_json():
img_json_out = json.loads(i.as_json())
assert all([omitted_key not in img_json_out for omitted_key in ['uri', 'href']])
#Make sure merges work
f2_json = json.loads(test_figure_json)
f2_json['caption'] = ''
f2 = Figure(f2_json)
assert f2.caption in ('', None)
f2.merge(f)
assert f2.caption == f.caption
def test_chapter_parsing():
webform_fig = Figure(json.loads(webform_json_precip))
......@@ -94,4 +105,4 @@ def test_dataset_special_properties():
if __name__ == '__main__':
test_chapter_parsing()
\ No newline at end of file
test_domain_as_json()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment