xmltodict
xmltodict copied to clipboard
Edge case with `pretty_print` and `short_empty_elements`
I expected that stripping out the "pretty" characters would be identical to the "non-pretty" result:
def test_pretty_print_and_short_empty_elements_with_empty_array():
input_dict = {"Foos": {"Foo": []}}
compact = unparse(
input_dict, pretty=False, short_empty_elements=True, full_document=False
)
pretty = unparse(
input_dict, pretty=True, short_empty_elements=True, full_document=False
)
pretty_compacted = pretty.replace("\n", "").replace("\t", "")
assert pretty_compacted == compact
But they are different:
> assert pretty_compacted == compact
E AssertionError: assert '<Foos></Foos>' == '<Foos/>'
E
E - <Foos/>
E + <Foos></Foos>
I realize this is a pretty (no pun intended) minor issue, but am I incorrect in thinking these two unparsings should be equivalent?
If you'd consider a PR to address this, I could take a crack at it.