def test_parsing_with_duplicates():
xml_with_duplicates = io.BytesIO(
b"""<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0">
<title>Another Compiler</title>
<codemeta:runtimePlatform>GNU/Linux</codemeta:runtimePlatform>
<codemeta:license>
<codemeta:name>GPL3.0</codemeta:name>
<codemeta:url>https://opensource.org/licenses/GPL-3.0</codemeta:url>
</codemeta:license>
<codemeta:runtimePlatform>Un*x</codemeta:runtimePlatform>
<codemeta:author>
<codemeta:name>author1</codemeta:name>
<codemeta:affiliation>Inria</codemeta:affiliation>
</codemeta:author>
<codemeta:author>
<codemeta:name>author2</codemeta:name>
<codemeta:affiliation>Inria</codemeta:affiliation>
</codemeta:author>
<codemeta:programmingLanguage>ocaml</codemeta:programmingLanguage>
<codemeta:programmingLanguage>haskell</codemeta:programmingLanguage>
<codemeta:license>
<codemeta:name>spdx</codemeta:name>
<codemeta:url>http://spdx.org</codemeta:url>
</codemeta:license>
<codemeta:programmingLanguage>python3</codemeta:programmingLanguage>
</entry>"""
)
actual_result = SWHXMLParser().parse(xml_with_duplicates)
expected_dict = OrderedDict(
[
("atom:title", "Another Compiler"),
("codemeta:runtimePlatform", ["GNU/Linux", "Un*x"]),
(
"codemeta:license",
[
OrderedDict(
[
("codemeta:name", "GPL3.0"),
("codemeta:url", "https://opensource.org/licenses/GPL-3.0"),
]
),
OrderedDict(
[("codemeta:name", "spdx"), ("codemeta:url", "http://spdx.org")]
),
],
),
(
"codemeta:author",
[
OrderedDict(
[
("codemeta:name", "author1"),
("codemeta:affiliation", "Inria"),
]
),
OrderedDict(
[
("codemeta:name", "author2"),
("codemeta:affiliation", "Inria"),
]
),
],
),
("codemeta:programmingLanguage", ["ocaml", "haskell", "python3"]),
]
)
> assert expected_dict == actual_result
E AssertionError: assert OrderedDict([... 'python3'])]) == OrderedDict([... 'python3'])])
E Omitting 4 identical items, use -vv to show
E Left contains 1 more item:
E {'atom:title': 'Another Compiler'}
E Right contains 1 more item:
E {'title': 'Another Compiler'}
E Full diff:
E - OrderedDict([('title', 'Another Compiler'),...
E
E ...Full output truncated (17 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_parsers.py:133: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 20 2020, 3:55 PM