cleanup d-t-w and typo in tests stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Mon, 22 Feb 2010 18:46:41 +0100
branchstable
changeset 496 3d89e70448af
parent 493 60caf3e67384
child 497 c0461bf2bf24
child 521 79a306edd23b
cleanup d-t-w and typo in tests
test/unittest_compare.py
--- a/test/unittest_compare.py	Tue Feb 16 15:35:06 2010 +0100
+++ b/test/unittest_compare.py	Mon Feb 22 18:46:41 2010 +0100
@@ -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):