diff --git a/test/unittest_compare.py b/test/unittest_compare.py index 60caf3e673849c0b0430fd496bef38908a9a3da7_dGVzdC91bml0dGVzdF9jb21wYXJlLnB5..3d89e70448af3fdf5142d7ef4d80cd82b13cc537_dGVzdC91bml0dGVzdF9jb21wYXJlLnB5 100644 --- a/test/unittest_compare.py +++ b/test/unittest_compare.py @@ -19,6 +19,6 @@ class RQLCompareClassTest(TestCase): """ Compare RQL strings """ - + def setUp(self): self.h = RQLHelper(DummySchema(), None) @@ -23,6 +23,6 @@ def setUp(self): self.h = RQLHelper(DummySchema(), None) - + def _compareEquivalent(self,r1,r2): """fails if the RQL strings r1 and r2 are equivalent""" self.skip('broken') @@ -37,7 +37,7 @@ # equivalent queries ################################################## def test_same_request_simple(self): - r = "Any X where X is Note ;" + r = "Any X WHERE X is Note ;" self._compareEquivalent(r, r) def test_same_request_diff_names(self): @@ -46,8 +46,8 @@ self._compareEquivalent(r1, r2) def test_same_request_diff_names_simple(self): - r1 = "Any X where X is Note ;" - r2 = "Any Y where Y is Note ;" + r1 = "Any X WHERE X is Note ;" + r2 = "Any Y WHERE Y is Note ;" self._compareEquivalent(r1, r2) def test_same_request_any(self): @@ -51,8 +51,8 @@ self._compareEquivalent(r1, r2) def test_same_request_any(self): - r1 = "Any X where X is Note ;" + r1 = "Any X WHERE X is Note ;" r2 = "Note X ;" self._compareEquivalent(r1, r2) def test_same_request_any_diff_names(self): @@ -55,9 +55,9 @@ r2 = "Note X ;" self._compareEquivalent(r1, r2) def test_same_request_any_diff_names(self): - r1 = "Any X where X is Note ;" + r1 = "Any X WHERE X is Note ;" r2 = "Note Y ;" self._compareEquivalent(r1, r2) def test_same_request_complex(self): @@ -60,8 +60,8 @@ r2 = "Note Y ;" self._compareEquivalent(r1, r2) def test_same_request_complex(self): - r = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" self._compareEquivalent(r, r) def test_same_request_comma_and(self): @@ -65,8 +65,8 @@ self._compareEquivalent(r, r) def test_same_request_comma_and(self): - r1 = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" - r2 = "Any N, N2 where N is Note AND N2 is Note AND N a_faire_par P1 AND P1 nom 'jphc' AND N2 a_faire_par P2 AND P2 nom 'ocy' ;" + r1 = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r2 = "Any N, N2 WHERE N is Note AND N2 is Note AND N a_faire_par P1 AND P1 nom 'jphc' AND N2 a_faire_par P2 AND P2 nom 'ocy' ;" self._compareEquivalent(r1, r2) def test_same_request_diff_names_complex(self): @@ -70,8 +70,8 @@ self._compareEquivalent(r1, r2) def test_same_request_diff_names_complex(self): - r1 = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" - r2 = "Any Y, X where X is Note, Y is Note, X a_faire_par A1, A1 nom 'ocy', Y a_faire_par A2, A2 nom 'jphc' ;" + r1 = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r2 = "Any Y, X WHERE X is Note, Y is Note, X a_faire_par A1, A1 nom 'ocy', Y a_faire_par A2, A2 nom 'jphc' ;" self._compareEquivalent(r1, r2) def test_same_request_diff_order(self): @@ -75,8 +75,8 @@ self._compareEquivalent(r1, r2) def test_same_request_diff_order(self): - r1 = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" - r2 = "Any N, N2 where N2 is Note, N is Note, N a_faire_par P1, N2 a_faire_par P2, P2 nom 'ocy', P1 nom 'jphc' ;" + r1 = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r2 = "Any N, N2 WHERE N2 is Note, N is Note, N a_faire_par P1, N2 a_faire_par P2, P2 nom 'ocy', P1 nom 'jphc' ;" self._compareEquivalent(r1, r2) def test_same_request_diff_order_diff_names(self): @@ -80,8 +80,8 @@ self._compareEquivalent(r1, r2) def test_same_request_diff_order_diff_names(self): - r1 = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" - r2 = "Any Y, X where X is Note, X a_faire_par P1, P1 nom 'ocy', Y is Note, Y a_faire_par P2, P2 nom 'jphc' ;" + r1 = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r2 = "Any Y, X WHERE X is Note, X a_faire_par P1, P1 nom 'ocy', Y is Note, Y a_faire_par P2, P2 nom 'jphc' ;" self._compareEquivalent(r1, r2) def test_same_request_with_comparison(self): @@ -117,8 +117,8 @@ # non equivalent queries ################################################## def test_diff_request(self): - r1 = "Any N, N2 where N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" - r2 = "Any X where X is Note ;" + r1 = "Any N, N2 WHERE N is Note, N2 is Note, N a_faire_par P1, P1 nom 'jphc', N2 a_faire_par P2, P2 nom 'ocy' ;" + r2 = "Any X WHERE X is Note ;" self._compareNotEquivalent(r1,r2) def test_diff_request_and_or(self): @@ -132,8 +132,8 @@ self._compareNotEquivalent(r1, r2) def test_diff_request_non_selected_var(self): - r1 = "Any X, D where X is Note, X creation_date D ;" - r2 = "Any X where X is Note, X creation_date D ;" + r1 = "Any X, D WHERE X is Note, X creation_date D ;" + r2 = "Any X WHERE X is Note, X creation_date D ;" self._compareNotEquivalent(r1, r2) def test_diff_request_aggregat(self): @@ -137,8 +137,8 @@ self._compareNotEquivalent(r1, r2) def test_diff_request_aggregat(self): - r1 = "Any X, D where X is Note, X creation_date D ;" - r2 = "Any X, MAX(D) where X is Note, X creation_date D ;" + r1 = "Any X, D WHERE X is Note, X creation_date D ;" + r2 = "Any X, MAX(D) WHERE X is Note, X creation_date D ;" self._compareNotEquivalent(r1, r2) def test_diff_request_group(self): @@ -142,8 +142,8 @@ self._compareNotEquivalent(r1, r2) def test_diff_request_group(self): - r1 = "Any X where X is Note GROUPBY X ;" - r2 = "Any X where X is Note;" + r1 = "Any X GROUPBY X WHERE X is Note;" + r2 = "Any X WHERE X is Note;" self._compareNotEquivalent(r1, r2) def test_diff_request_sort(self): @@ -147,8 +147,8 @@ self._compareNotEquivalent(r1, r2) def test_diff_request_sort(self): - r1 = "Any X where X is Note ORDERBY X ;" - r2 = "Any X where X is Note;" + r1 = "Any X ORDERBY X WHERE X is Note;" + r2 = "Any X WHERE X is Note;" self._compareNotEquivalent(r1, r2) def test_diff_request_not(self): @@ -152,8 +152,8 @@ self._compareNotEquivalent(r1, r2) def test_diff_request_not(self): - r1 = "Any X where not X is Note ;" - r2 = "Any X where X is Note;" + r1 = "Any X WHERE NOT X is Note ;" + r2 = "Any X WHERE X is Note;" self._compareNotEquivalent(r1, r2) def test_diff_request_not_in_or(self):