Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_metadata.py
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | - | ||||
family-names: Klaver | family-names: Klaver | ||||
given-names: Tom | given-names: Tom | ||||
- | - | ||||
affiliation: "Humboldt-Universität zu Berlin" | affiliation: "Humboldt-Universität zu Berlin" | ||||
family-names: Druskat | family-names: Druskat | ||||
given-names: Stephan | given-names: Stephan | ||||
orcid: https://orcid.org/0000-0003-4925-7248 | orcid: https://orcid.org/0000-0003-4925-7248 | ||||
cff-version: "1.0.3" | cff-version: "1.0.3" | ||||
date-released: 2019-11-12 | date-released: "2019-11-12" | ||||
doi: 10.5281/zenodo.1162057 | doi: 10.5281/zenodo.1162057 | ||||
keywords: | keywords: | ||||
- "citation" | - "citation" | ||||
- "bibliography" | - "bibliography" | ||||
- "cff" | - "cff" | ||||
- "CITATION.cff" | - "CITATION.cff" | ||||
license: Apache-2.0 | license: Apache-2.0 | ||||
message: "If you use this software, please cite it using these metadata." | message: "If you use this software, please cite it using these metadata." | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | RIS, schema.org, CodeMeta, and .zenodo.json.""", | ||||
"version": "1.4.0-alpha0", | "version": "1.4.0-alpha0", | ||||
} | } | ||||
# when | # when | ||||
result = self.cff_mapping.translate(content) | result = self.cff_mapping.translate(content) | ||||
# then | # then | ||||
assert expected == result | assert expected == result | ||||
def test_compute_metadata_cff_invalid_yaml(self): | |||||
""" | |||||
test.yaml translation for invalid yaml file | |||||
""" | |||||
# given | |||||
content = """cff-version: 1.0.3 | |||||
message: To cite the SigMF specification, please include the following: | |||||
authors: | |||||
- name: The GNU Radio Foundation, Inc. | |||||
title: The Signal Metadata Format (SigMF) | |||||
version: 0.0.1 | |||||
doi: 10.5281/zenodo.1418396 | |||||
date-released: 2018-07-18 | |||||
license: CC-BY-SA-4.0 | |||||
vlorentz: you can simplify this example, to only keep what matters to the test. It makes the test more… | |||||
Done Inline Actionsok, I'll take the unnecessary part out. Would you like me to add a comment describing what is wrong in content? VickyMerzOwn: ok, I'll take the unnecessary part out. Would you like me to add a comment describing what is… | |||||
Done Inline Actionsyes, please vlorentz: yes, please | |||||
url: https://sigmf.org | |||||
""".encode( | |||||
"utf-8" | |||||
) | |||||
expected = None | |||||
result = self.cff_mapping.translate(content) | |||||
# then | |||||
assert expected == result | |||||
def test_compute_metadata_npm(self): | def test_compute_metadata_npm(self): | ||||
""" | """ | ||||
testing only computation of metadata with hard_mapping_npm | testing only computation of metadata with hard_mapping_npm | ||||
""" | """ | ||||
# given | # given | ||||
content = b""" | content = b""" | ||||
{ | { | ||||
"name": "test_metadata", | "name": "test_metadata", | ||||
▲ Show 20 Lines • Show All 1,088 Lines • Show Last 20 Lines |
you can simplify this example, to only keep what matters to the test. It makes the test more readable. (Right now, I don't see what part of this file is the syntax error)