def test_to_graph_should_return_homepage() -> None: """It returns a homepage graph isomorphic to spec.""" catalog = Catalog() catalog.identifier = "http://example.com/catalogs/1" catalog.homepage = "http://example.org/catalog" src = """ @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://example.com/catalogs/1> a dcat:Catalog ; foaf:homepage <http://example.org/catalog> ; . """ g1 = Graph().parse(data=catalog.to_rdf(), format="turtle") g2 = Graph().parse(data=src, format="turtle") _isomorphic = isomorphic(g1, g2) if not _isomorphic: _dump_diff(g1, g2) pass assert _isomorphic
def _add_optional_catalog_props(catalog: Catalog) -> None: catalog.homepage = URI(os.environ["CATALOG_HOMEPAGE"])