From f1cbb5e41c89925ca492cd39182c5b23cc5b8379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Sun, 23 Dec 2012 20:20:02 +0100 Subject: Ensure that parse in ConjunctiveGraph uses a URIRef as graph identifier --- test/test_conjunctive_graph.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/test_conjunctive_graph.py (limited to 'test') diff --git a/test/test_conjunctive_graph.py b/test/test_conjunctive_graph.py new file mode 100644 index 00000000..0ada5077 --- /dev/null +++ b/test/test_conjunctive_graph.py @@ -0,0 +1,32 @@ +from rdflib.graph import ConjunctiveGraph +from rdflib.term import Identifier, URIRef +from rdflib.parser import StringInputSource +from os import path + + +DATA = u""" + a . +""" + +PUBLIC_ID = u"http://example.org/record/1" + + +def test_graph_ids(): + def check(kws): + cg = ConjunctiveGraph() + cg.parse(**kws) + + for g in cg.contexts(): + gid = g.identifier + assert isinstance(gid, Identifier) + + yield check, dict(data=DATA, publicID=PUBLIC_ID, format="turtle") + + source = StringInputSource(DATA) + source.setPublicId(PUBLIC_ID) + yield check, dict(source=source, format='turtle') + + +if __name__ == '__main__': + import nose + nose.main(defaultTest=__name__) -- cgit v1.2.1