Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_metadata.py
Show First 20 Lines • Show All 153 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 | |||||
url: https://sigmf.org | |||||
vlorentz: you can simplify this example, to only keep what matters to the test. It makes the test more… | |||||
VickyMerzOwnAuthorUnsubmitted 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… | |||||
vlorentzUnsubmitted Done Inline Actionsyes, please vlorentz: yes, please | |||||
""".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)