def test_multiple_values_rdfa(capsys, csv_reader): """Check if multiple values support in RDFa.""" text = 'property="schema:alternateName"' n.COLUMNS['alternateName'] = "Synonyms" outputs.rdfa(csv_reader, 1) stdout, stderr = capsys.readouterr() assert stderr == "" assert stdout.count(text) > 1
def test_rdfa_text_limit_identifier(capsys, csv_reader): """Check if required string is in RDFa output, limit 4, custom identifier.""" text = "143831-71-4" n.COLUMNS['identifier'] = "CAS" outputs.rdfa(csv_reader, 4) stdout, stderr = capsys.readouterr() assert stderr == "" assert text in stdout
def test_rdfa_bnode(capsys, csv_reader): """Check if RDFa output have bnode for bode subject type.""" text = '_:b0' n.COLUMNS['identifier'] = "CAS" n.SUBJECT_BASE = '_:b' outputs.rdfa(csv_reader) stdout, stderr = capsys.readouterr() assert stderr == "" assert text in stdout
def test_rdfa_uuid(capsys, csv_reader): """Check if RDFa output have urn:uuid: for UUID subject type.""" text = 'about="urn:uuid:' n.COLUMNS['identifier'] = "CAS" n.SUBJECT_BASE = False outputs.rdfa(csv_reader) stdout, stderr = capsys.readouterr() assert stderr == "" assert text in stdout
def test_rdfa_contains_required_strings(capsys, csv_reader): """Test if rdfa output contains required strings.""" # set column name n.COLUMNS['name'] = "Common name" # list of strings to check strings = ['<', '>', '</', 'typeof', 'property', 'MolecularEntity', 'name'] outputs.rdfa(csv_reader, None) stdout, stderr = capsys.readouterr() assert all(s in stdout for s in strings) assert stderr == ""
def test_rdfa_iri_id(capsys, csv_reader): """Check if RDFa output have IRI for IRI subject type with id.""" text = 'about="http://example.com/molecule#m1"' text2 = 'id="m1"' n.COLUMNS['name'] = "Common name" n.SUBJECT_BASE = "http://example.com/molecule#m" outputs.rdfa(csv_reader) stdout, stderr = capsys.readouterr() assert stderr == "" assert text in stdout assert text2 in stdout