Skip to content

Commit

Permalink
Improve handling of emtpy values
Browse files Browse the repository at this point in the history
  • Loading branch information
physikerwelt committed Jan 9, 2024
1 parent 6dcd6a5 commit a081191
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/zbmath_rest2oai/getAsXml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dict2xml import dict2xml
import dict2xml


def final_xml2(de):
Expand All @@ -8,7 +8,7 @@ def final_xml2(de):

r = requests.get('https://api.zbmath.org/v1/document/' + de, headers=headers)

return dict2xml(r.json(), wrap='root', indent=" ")
return dict2xml.Converter(wrap="root").build(r.json(), closed_tags_for=[[], '', [None], None])


print(final_xml2("6383667"))
2 changes: 1 addition & 1 deletion tests/test_plain_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_similarity(self):
'ratio_mode': 'accurate'
})
essentials = list(filter(lambda e: not isinstance(e, MoveNode), diff))
self.assertLessEqual(len(essentials), 97)
self.assertLessEqual(len(essentials), 46)
diff_text = main.diff_texts(expected_string, real_string, {
'ratio_mode': 'accurate'
}, formatter=formatting.XMLFormatter(normalize=formatting.WS_BOTH))
Expand Down

0 comments on commit a081191

Please sign in to comment.