# HG changeset patch # User Nicolas Chauvat <nicolas.chauvat@logilab.fr> # Date 1266860801 -3600 # Mon Feb 22 18:46:41 2010 +0100 # Branch stable # Node ID 3d89e70448af3fdf5142d7ef4d80cd82b13cc537 # Parent 60caf3e673849c0b0430fd496bef38908a9a3da7 cleanup d-t-w and typo in tests diff --git a/test/unittest_compare.py b/test/unittest_compare.py --- a/test/unittest_compare.py +++ b/test/unittest_compare.py @@ -19,10 +19,10 @@ class RQLCompareClassTest(TestCase): """ Compare RQL strings """ - + 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,42 +46,42 @@ 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): - 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): - 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): - 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): - 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): - 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): - 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): - 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,28 +132,28 @@ 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): - 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): - 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): - 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): - 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):