def test_parse_without_source(): """ When we try to parse without a 'source' argument, do we get the correct error type? """ expo = Exporter() with pytest.raises(TypeError): expo.parse(source=None)
def test_parse(): """ Can the parse() method actually parse an RDF graph? After parsing, is the graph identical to what RDFLib parses? """ expo = Exporter() expo.parse(source=SAMPLE_LOCATION) graph = rdflib.Graph() graph.parse(source=SAMPLE_LOCATION, format='n3') assert graph.isomorphic(expo.graph)
def test_load_parse_and_export(data_pool): """ Can we load and parse data, then export it? Test passes if we can load, parse and export without error, and the exported graph is the same as the one stored in the Exporter object. """ fname = tempfile.mktemp() expo = Exporter() ref = data_pool.get_reference() expo.parse(SAMPLE_LOCATION) expo.load(ref) expo.export(filename=fname) current_graph = rdflib.Graph().parse(fname, format='n3') assert current_graph.isomorphic(expo.graph)