@@ -0,0 +1,846 @@
+from rdflib import ConjunctiveGraph, Literal%0Afrom StringIO import StringIO%0Aimport unittest%0A%0A%0Atest_data = %22%22%22%0A@prefix foaf:       %3Chttp://xmlns.com/foaf/0.1/%3E .%0A@prefix rdf:        %3Chttp://www.w3.org/1999/02/22-rdf-syntax-ns#%3E .%0A%0A%3Chttp://example.org/alice%3E a foaf:Person;%0A    foaf:name %22Alice%22;%0A    foaf:knows %3Chttp://example.org/bob%3E .%22%22%22%0A%0Atest_query = %22%22%22%0ABASE %3Chttp://xmlns.com/foaf/0.1/%3E%0ASELECT ?name%0AWHERE %7B %5B a :Person; :name ?name %5D. %7D%0A%7D%22%22%22%0A%0Aclass TestSparqlJsonResults(unittest.TestCase):%0A%0A    def setUp(self):%0A        self.graph = ConjunctiveGraph()%0A        self.graph.parse(StringIO(test_data), format=%22n3%22)%0A%0A    def test_base_ref(self):%0A        rt=self.graph.query(test_query).serialize(%22python%22)%0A        self.failUnless(rt%5B0%5D == Literal(%22Alice%22),%22Expected:%5Cn 'Alice' %5CnGot:%5Cn %25s%22 %25 rt)%0A%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A%0A

Test for use of BASE <..>