Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/metadata_dictionary/test_codemeta.py
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | <entry xmlns="http://www.w3.org/2005/Atom" | ||||
<codemeta:name>My Software</codemeta:name> | <codemeta:name>My Software</codemeta:name> | ||||
<codemeta:author> | <codemeta:author> | ||||
<codemeta:name>Author 1</codemeta:name> | <codemeta:name>Author 1</codemeta:name> | ||||
<codemeta:email>foo@example.org</codemeta:email> | <codemeta:email>foo@example.org</codemeta:email> | ||||
</codemeta:author> | </codemeta:author> | ||||
<codemeta:author> | <codemeta:author> | ||||
<codemeta:name>Author 2</codemeta:name> | <codemeta:name>Author 2</codemeta:name> | ||||
</codemeta:author> | </codemeta:author> | ||||
<author> | |||||
<name>Author 3</name> | |||||
<email>bar@example.org</email> | |||||
</author> | |||||
</entry> | </entry> | ||||
""" | """ | ||||
result = MAPPINGS["SwordCodemetaMapping"]().translate(content) | result = MAPPINGS["SwordCodemetaMapping"]().translate(content) | ||||
assert result == { | assert result == { | ||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", | ||||
"name": "My Software", | "name": "My Software", | ||||
"author": [ | "author": [ | ||||
{"name": "Author 1", "email": "foo@example.org"}, | {"name": "Author 1", "email": "foo@example.org"}, | ||||
{"name": "Author 2"}, | {"name": "Author 2"}, | ||||
{"name": "Author 3", "email": "bar@example.org"}, | |||||
], | ], | ||||
} | } | ||||
def test_sword_mixed(): | def test_sword_mixed(): | ||||
content = """<?xml version="1.0"?> | content = """<?xml version="1.0"?> | ||||
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" | <atom:entry xmlns:atom="http://www.w3.org/2005/Atom" | ||||
xmlns="https://doi.org/10.5063/schema/codemeta-2.0" | xmlns="https://doi.org/10.5063/schema/codemeta-2.0" | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |