summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNiklas Lindström <lindstream@gmail.com>2012-12-23 20:20:02 +0100
committerNiklas Lindström <lindstream@gmail.com>2012-12-23 20:20:02 +0100
commitf1cbb5e41c89925ca492cd39182c5b23cc5b8379 (patch)
treea56a098bcd8d347b1ac121e90c3a0d05aa27b011 /test
parent5fb4278c08beef36b35f586560fcde58a0acd984 (diff)
downloadrdflib-f1cbb5e41c89925ca492cd39182c5b23cc5b8379.tar.gz
Ensure that parse in ConjunctiveGraph uses a URIRef as graph identifier
Diffstat (limited to 'test')
-rw-r--r--test/test_conjunctive_graph.py32
1 files changed, 32 insertions, 0 deletions
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"""
+<http://example.org/record/1> a <http://xmlns.com/foaf/0.1/Document> .
+"""
+
+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__)