diff options
author | Joern Hees <dev@joernhees.de> | 2015-02-25 13:50:11 +0100 |
---|---|---|
committer | Joern Hees <dev@joernhees.de> | 2015-02-25 13:50:11 +0100 |
commit | 46567b44825a58142f039f22460302bbc29a1572 (patch) | |
tree | 4c559b5ea9d53ff261d9a726052cab5eb3823341 /test | |
parent | c316789e84e8f2c039348e00e34575f849c410b0 (diff) | |
download | rdflib-46567b44825a58142f039f22460302bbc29a1572.tar.gz |
added further test for #457 using a local sparql store
Diffstat (limited to 'test')
-rw-r--r-- | test/test_sparqlupdatestore.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/test/test_sparqlupdatestore.py b/test/test_sparqlupdatestore.py index 2d54d0cb..73ac97de 100644 --- a/test/test_sparqlupdatestore.py +++ b/test/test_sparqlupdatestore.py @@ -2,7 +2,7 @@ import unittest import re -from rdflib import ConjunctiveGraph, URIRef +from rdflib import ConjunctiveGraph, URIRef, Literal from rdflib.util import from_n3 # this assumed SPARQL1.1 query/update endpoints @@ -105,23 +105,23 @@ class TestSparql11(unittest.TestCase): def testUpdate(self): self.graph.update("INSERT DATA { GRAPH <urn:graph> { <urn:michel> <urn:likes> <urn:pizza> . } }") - + g = self.graph.get_context(graphuri) self.assertEquals(1, len(g), 'graph contains 1 triples') - + def testUpdateWithInitNs(self): self.graph.update( "INSERT DATA { GRAPH ns:graph { ns:michel ns:likes ns:pizza . } }", initNs={'ns': URIRef('urn:')} ) - + g = self.graph.get_context(graphuri) self.assertEquals( set(g.triples((None,None,None))), set([(michel,likes,pizza)]), 'only michel likes pizza' ) - + def testUpdateWithInitBindings(self): self.graph.update( "INSERT { GRAPH <urn:graph> { ?a ?b ?c . } } WherE { }", @@ -131,7 +131,7 @@ class TestSparql11(unittest.TestCase): 'c': URIRef('urn:pizza'), } ) - + g = self.graph.get_context(graphuri) self.assertEquals( set(g.triples((None,None,None))), @@ -150,7 +150,7 @@ class TestSparql11(unittest.TestCase): 'd': URIRef('urn:bob'), } ) - + g = self.graph.get_context(graphuri) self.assertEquals( set(g.triples((None,None,None))), @@ -269,6 +269,18 @@ class TestSparql11(unittest.TestCase): self.assertTrue(empty_graph_iri in [unicode(g.identifier) for g in self.graph.contexts()]) + def testEmptyLiteral(self): + # test for https://github.com/RDFLib/rdflib/issues/457 + # also see test_issue457.py which is sparql store independent! + g = self.graph.get_context(graphuri) + g.add(( + URIRef('http://example.com/s'), + URIRef('http://example.com/p'), + Literal(''))) + + o = tuple(g)[0][2] + self.assertEquals(o, Literal(''), repr(o)) + from nose import SkipTest import urllib2 try: |