[tracker/sparql-update] functional-tests: Add another GRAPH with REPLACE behaviour test
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sparql-update] functional-tests: Add another GRAPH with REPLACE behaviour test
- Date: Thu, 24 Mar 2011 14:23:51 +0000 (UTC)
commit a1657c73f64ac957812f1500ef7c1673dbc008e6
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Mar 24 15:23:16 2011 +0100
functional-tests: Add another GRAPH with REPLACE behaviour test
tests/functional-tests/01-insertion.py | 36 ++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/tests/functional-tests/01-insertion.py b/tests/functional-tests/01-insertion.py
index 4496c52..2cfd984 100755
--- a/tests/functional-tests/01-insertion.py
+++ b/tests/functional-tests/01-insertion.py
@@ -334,10 +334,10 @@ class TrackerStoreInsertionTests (CommonTrackerStoreTest):
Insert or replace, single and multi valued properties with graphs
"""
- INSERT_SPARQL = """INSERT { GRAPH <test://graph-1> { <test://instance-6> a nie:InformationElement ; nie:title 'test' } }"""
+ INSERT_SPARQL = """INSERT { GRAPH <test://graph-1> { <test://instance-6> a nie:InformationElement ; nie:title 'title 1' } }"""
self.tracker.update (INSERT_SPARQL)
- INSERT_SPARQL = """INSERT OR REPLACE { GRAPH <test://graph-2> { <test://instance-6> nie:title 'test' } }"""
+ INSERT_SPARQL = """INSERT { GRAPH <test://graph-2> { <test://instance-6> nie:title 'title 1' } }"""
self.tracker.update (INSERT_SPARQL)
result = self.tracker.query ("""
@@ -347,8 +347,36 @@ class TrackerStoreInsertionTests (CommonTrackerStoreTest):
self.assertEquals (len (result), 1)
self.assertEquals (len (result[0]), 2)
- self.assertEquals (result[0][0], "test://graph-2")
- self.assertEquals (result[0][1], "test")
+ self.assertEquals (result[0][0], "test://graph-1") # Yes, indeed
+ self.assertEquals (result[0][1], "title 1")
+
+ INSERT_SPARQL = """INSERT OR REPLACE { GRAPH <test://graph-2> { <test://instance-6> nie:title 'title 1' } }"""
+ self.tracker.update (INSERT_SPARQL)
+
+ result = self.tracker.query ("""
+ SELECT ?g ?t WHERE { GRAPH ?g {
+ <test://instance-6> nie:title ?t
+ } }""")
+
+ self.assertEquals (len (result), 1)
+ self.assertEquals (len (result[0]), 2)
+ self.assertEquals (result[0][0], "test://graph-2") # Yup, that's right
+ self.assertEquals (result[0][1], "title 1")
+
+
+ INSERT_SPARQL = """INSERT OR REPLACE { GRAPH <test://graph-3> { <test://instance-6> nie:title 'title 2' } }"""
+ self.tracker.update (INSERT_SPARQL)
+
+ result = self.tracker.query ("""
+ SELECT ?g ?t WHERE { GRAPH ?g {
+ <test://instance-6> nie:title ?t
+ } }""")
+
+ self.assertEquals (len (result), 1)
+ self.assertEquals (len (result[0]), 2)
+ self.assertEquals (result[0][0], "test://graph-3")
+ self.assertEquals (result[0][1], "title 2")
+
def __insert_valid_date_test (self, datestring, year, month, day, hours, minutes, seconds, timezone):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]