Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.indexer.tests.test_metadata.TestMetadata::test_compute_metadata_cff
Failed

TEST RESULT

Run At
Jun 24 2022, 8:06 PM
Details
self = <swh.indexer.tests.test_metadata.TestMetadata object at 0x7fe69ff03be0> def test_compute_metadata_cff(self): """ testing CITATION.cff translation """ # given content = """# YAML 1.2 --- abstract: "Command line program to convert from Citation File \ Format to various other formats such as BibTeX, EndNote, RIS, \ schema.org, CodeMeta, and .zenodo.json." authors: - affiliation: "Netherlands eScience Center" family-names: Klaver given-names: Tom - affiliation: "Humboldt-Universität zu Berlin" family-names: Druskat given-names: Stephan orcid: https://orcid.org/0000-0003-4925-7248 cff-version: "1.0.3" date-released: 2019-11-12 doi: 10.5281/zenodo.1162057 keywords: - "citation" - "bibliography" - "cff" - "CITATION.cff" license: Apache-2.0 message: "If you use this software, please cite it using these metadata." repository-code: "https://github.com/citation-file-format/cff-converter-python" title: cffconvert version: "1.4.0-alpha0" """.encode( "utf-8" ) expected = { "@context": "https://doi.org/10.5063/schema/codemeta-2.0", "type": "SoftwareSourceCode", "author": [ { "type": "Person", "affiliation": { "type": "Organization", "name": "Netherlands eScience Center", }, "familyName": "Klaver", "givenName": "Tom", }, { "id": "https://orcid.org/0000-0003-4925-7248", "type": "Person", "affiliation": { "type": "Organization", "name": "Humboldt-Universität zu Berlin", }, "familyName": "Druskat", "givenName": "Stephan", }, ], "codeRepository": ( "https://github.com/citation-file-format/cff-converter-python" ), "datePublished": "2019-11-12", "description": """Command line program to convert from \ Citation File Format to various other formats such as BibTeX, EndNote, \ RIS, schema.org, CodeMeta, and .zenodo.json.""", "identifier": "https://doi.org/10.5281/zenodo.1162057", "keywords": ["citation", "bibliography", "cff", "CITATION.cff"], "license": "https://spdx.org/licenses/Apache-2.0", "version": "1.4.0-alpha0", } # when > result = self.cff_mapping.translate(content) .tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_metadata.py:158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/indexer/metadata_dictionary/cff.py:33: in translate content_dict_checked = self.value_type_check(content_dict) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.indexer.metadata_dictionary.cff.CffMapping object at 0x7fe69c06a4a8> content_dict = {'abstract': 'Command line program to convert from Citation File Format to various other formats such as BibTeX, EndNo...ephan', 'orcid': 'https://orcid.org/0000-0003-4925-7248'}], 'cff-version': '1.0.3', 'date-released': '2019-11-12', ...} def value_type_check(self, content_dict): type_checked_content_dict = {} for field in content_dict: if field == "authors": authors = [] for author in content_dict["authors"]: author_checked = {} if isinstance(author["given-names"], str): author_checked["given-names"] = author["given-names"] > if isinstance(author["name-particle"], str): E KeyError: 'name-particle' .tox/py3/lib/python3.7/site-packages/swh/indexer/metadata_dictionary/cff.py:55: KeyError