unittest2 api update stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 11 Oct 2010 11:33:36 +0200
branchstable
changeset 595 d0c3ec1701b9
parent 594 6eac2a0ea919
child 596 ea7ad74f8190
child 601 0e3ca3b0425f
unittest2 api update
test/unittest_analyze.py
test/unittest_compare.py
test/unittest_editextensions.py
test/unittest_nodes.py
test/unittest_parser.py
test/unittest_rqlgen.py
test/unittest_stcheck.py
test/unittest_utils.py
--- a/test/unittest_analyze.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_analyze.py	Mon Oct 11 11:33:36 2010 +0200
@@ -311,19 +311,19 @@
     def test_uid_func_mapping(self):
         h = self.helper
         def type_from_uid(name):
-            self.assertEquals(name, "Logilab")
+            self.assertEqual(name, "Logilab")
             return 'Company'
         uid_func_mapping = {'name': type_from_uid}
         # constant as rhs of the uid relation
         node = h.parse('Any X WHERE X name "Logilab"')
         h.compute_solutions(node, uid_func_mapping, debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, [{'X': 'Company'}])
+        self.assertEqual(sols, [{'X': 'Company'}])
         # variable as rhs of the uid relation
         node = h.parse('Any N WHERE X name N')
         h.compute_solutions(node, uid_func_mapping, debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, [{'X': 'Company', 'N': 'String'},
+        self.assertEqual(sols, [{'X': 'Company', 'N': 'String'},
                                  {'X': 'Person', 'N': 'String'},
                                  {'X': 'Student', 'N': 'String'}])
         # substitute as rhs of the uid relation
@@ -331,19 +331,19 @@
         h.compute_solutions(node, uid_func_mapping, {'company': 'Logilab'},
                         debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, [{'X': 'Company'}])
+        self.assertEqual(sols, [{'X': 'Company'}])
 
     def test_non_regr_subjobj1(self):
         h = self.helper
         def type_from_uid(name):
-            self.assertEquals(name, "Societe")
+            self.assertEqual(name, "Societe")
             return 'Eetype'
         uid_func_mapping = {'name': type_from_uid}
         # constant as rhs of the uid relation
         node = h.parse('Any X WHERE X name "Societe", X is ISOBJ, ISSIBJ is X')
         h.compute_solutions(node, uid_func_mapping, debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, [{'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Address'},
+        self.assertEqual(sols, [{'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Address'},
                                  {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Company'},
                                  {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Eetype'},
                                  {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Person'},
@@ -352,46 +352,46 @@
     def test_non_regr_subjobj2(self):
         h = self.helper
         def type_from_uid(name):
-            self.assertEquals(name, "Societe")
+            self.assertEqual(name, "Societe")
             return 'Eetype'
         uid_func_mapping = {'name': type_from_uid}
         node = h.parse('Any X WHERE X name "Societe", X is ISOBJ, ISSUBJ is X, X is_instance_of ISIOOBJ, ISIOSUBJ is_instance_of X')
         h.compute_solutions(node, uid_func_mapping, debug=DEBUG)
         select = node.children[0]
         sols = sorted(select.solutions)
-        self.assertEquals(len(sols), 25)
+        self.assertEqual(len(sols), 25)
         def var_sols(var):
             s = set()
             for sol in sols:
                 s.add(sol.get(var))
             return s
-        self.assertEquals(var_sols('X'), set(('Eetype',)))
-        self.assertEquals(var_sols('X'), select.defined_vars['X'].stinfo['possibletypes'])
-        self.assertEquals(var_sols('ISSUBJ'), set(('Address', 'Company', 'Eetype', 'Person', 'Student')))
-        self.assertEquals(var_sols('ISSUBJ'), select.defined_vars['ISSUBJ'].stinfo['possibletypes'])
-        self.assertEquals(var_sols('ISOBJ'), set(('Eetype',)))
-        self.assertEquals(var_sols('ISOBJ'), select.defined_vars['ISOBJ'].stinfo['possibletypes'])
-        self.assertEquals(var_sols('ISIOSUBJ'), set(('Address', 'Company', 'Eetype', 'Person', 'Student')))
-        self.assertEquals(var_sols('ISIOSUBJ'), select.defined_vars['ISIOSUBJ'].stinfo['possibletypes'])
-        self.assertEquals(var_sols('ISIOOBJ'), set(('Eetype',)))
-        self.assertEquals(var_sols('ISIOOBJ'), select.defined_vars['ISIOOBJ'].stinfo['possibletypes'])
+        self.assertEqual(var_sols('X'), set(('Eetype',)))
+        self.assertEqual(var_sols('X'), select.defined_vars['X'].stinfo['possibletypes'])
+        self.assertEqual(var_sols('ISSUBJ'), set(('Address', 'Company', 'Eetype', 'Person', 'Student')))
+        self.assertEqual(var_sols('ISSUBJ'), select.defined_vars['ISSUBJ'].stinfo['possibletypes'])
+        self.assertEqual(var_sols('ISOBJ'), set(('Eetype',)))
+        self.assertEqual(var_sols('ISOBJ'), select.defined_vars['ISOBJ'].stinfo['possibletypes'])
+        self.assertEqual(var_sols('ISIOSUBJ'), set(('Address', 'Company', 'Eetype', 'Person', 'Student')))
+        self.assertEqual(var_sols('ISIOSUBJ'), select.defined_vars['ISIOSUBJ'].stinfo['possibletypes'])
+        self.assertEqual(var_sols('ISIOOBJ'), set(('Eetype',)))
+        self.assertEqual(var_sols('ISIOOBJ'), select.defined_vars['ISIOOBJ'].stinfo['possibletypes'])
 
     def test_unusableuid_func_mapping(self):
         h = self.helper
         def type_from_uid(name):
-            self.assertEquals(name, "Logilab")
+            self.assertEqual(name, "Logilab")
             return 'Company'
         uid_func_mapping = {'name': type_from_uid}
         node = h.parse('Any X WHERE NOT X name %(company)s')
         h.compute_solutions(node, uid_func_mapping, {'company': 'Logilab'},
                             debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, ALL_SOLS)
+        self.assertEqual(sols, ALL_SOLS)
         node = h.parse('Any X WHERE X name > %(company)s')
         h.compute_solutions(node, uid_func_mapping, {'company': 'Logilab'},
                             debug=DEBUG)
         sols = sorted(node.children[0].solutions)
-        self.assertEquals(sols, ALL_SOLS)
+        self.assertEqual(sols, ALL_SOLS)
 
 
     def test_base_guess_3(self):
@@ -500,7 +500,7 @@
                          [{'X': 'Person', 'F': 'String'}])
         # auto-simplification
         self.assertEqual(len(node.children[0].with_[0].query.children), 1)
-        self.assertEquals(node.as_string(), 'Any L,Y,F WHERE Y located L, Y is Person WITH Y,F BEING (Any X,F WHERE X is Person, X firstname F)')
+        self.assertEqual(node.as_string(), 'Any L,Y,F WHERE Y located L, Y is Person WITH Y,F BEING (Any X,F WHERE X is Person, X firstname F)')
         self.assertEqual(node.children[0].with_[0].query.children[0].solutions,
                          [{'X': 'Person', 'F': 'String'}])
 
--- a/test/unittest_compare.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_compare.py	Mon Oct 11 11:33:36 2010 +0200
@@ -39,11 +39,11 @@
 
     def setUp(self):
         self.h = RQLHelper(DummySchema(), None)
-        self.skip('broken')
+        self.skipTest('broken')
 
     def _compareEquivalent(self,r1,r2):
         """fails if the RQL strings r1 and r2 are equivalent"""
-        self.skip('broken')
+        self.skipTest('broken')
         self.failUnless(self.h.compare(r1, r2),
                         'r1: %s\nr2: %s' % (r1, r2))
 
--- a/test/unittest_editextensions.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_editextensions.py	Mon Oct 11 11:33:36 2010 +0200
@@ -32,12 +32,12 @@
         select.remove_selected(select.selection[0])
         select.add_selected(var)
         # check operations
-        self.assertEquals(rqlst.as_string(), 'Any %s WHERE X is Person' % var.name)
+        self.assertEqual(rqlst.as_string(), 'Any %s WHERE X is Person' % var.name)
         # check references before recovering
         rqlst.check_references()
         rqlst.recover()
         # check equivalence after recovering
-        self.assertEquals(rqlst.as_string(), orig)
+        self.assertEqual(rqlst.as_string(), orig)
         # check references after recovering
         rqlst.check_references()
     
@@ -50,12 +50,12 @@
         select.remove_selected(select.selection[0])
         select.add_selected(var)
         # check operations
-        self.assertEquals(rqlst.as_string(), 'Any %s WHERE X is Person, X name N' % var.name)
+        self.assertEqual(rqlst.as_string(), 'Any %s WHERE X is Person, X name N' % var.name)
         # check references before recovering
         rqlst.check_references()
         rqlst.recover()
         # check equivalence after recovering
-        self.assertEquals(rqlst.as_string(), orig)
+        self.assertEqual(rqlst.as_string(), orig)
         # check references after recovering
         rqlst.check_references()
         
@@ -65,12 +65,12 @@
         rqlst.save_state()
         rqlst.children[0].undefine_variable(rqlst.children[0].defined_vars['Y'])
         # check operations
-        self.assertEquals(rqlst.as_string(), 'Any X WHERE X is Person')
+        self.assertEqual(rqlst.as_string(), 'Any X WHERE X is Person')
         # check references before recovering
         rqlst.check_references()
         rqlst.recover()
         # check equivalence
-        self.assertEquals(rqlst.as_string(), orig)
+        self.assertEqual(rqlst.as_string(), orig)
         # check references after recovering
         rqlst.check_references()
         
@@ -82,12 +82,12 @@
         var = rqlst.children[0].make_variable()
         rqlst.children[0].add_selected(var)
         # check operations
-        self.assertEquals(rqlst.as_string(), 'Any A')
+        self.assertEqual(rqlst.as_string(), 'Any A')
         # check references before recovering
         rqlst.check_references()
         rqlst.recover()
         # check equivalence
-        self.assertEquals(rqlst.as_string(), orig)
+        self.assertEqual(rqlst.as_string(), orig)
         # check references after recovering
         rqlst.check_references()
         
--- a/test/unittest_nodes.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_nodes.py	Mon Oct 11 11:33:36 2010 +0200
@@ -36,23 +36,23 @@
 
 class EtypeFromPyobjTC(TestCase):
     def test_bool(self):
-        self.assertEquals(nodes.etype_from_pyobj(True), 'Boolean')
-        self.assertEquals(nodes.etype_from_pyobj(False), 'Boolean')
+        self.assertEqual(nodes.etype_from_pyobj(True), 'Boolean')
+        self.assertEqual(nodes.etype_from_pyobj(False), 'Boolean')
 
     def test_int(self):
-        self.assertEquals(nodes.etype_from_pyobj(0), 'Int')
-        self.assertEquals(nodes.etype_from_pyobj(1L), 'Int')
+        self.assertEqual(nodes.etype_from_pyobj(0), 'Int')
+        self.assertEqual(nodes.etype_from_pyobj(1L), 'Int')
 
     def test_float(self):
-        self.assertEquals(nodes.etype_from_pyobj(0.), 'Float')
+        self.assertEqual(nodes.etype_from_pyobj(0.), 'Float')
 
     def test_datetime(self):
-        self.assertEquals(nodes.etype_from_pyobj(datetime.now()), 'Datetime')
-        self.assertEquals(nodes.etype_from_pyobj(date.today()), 'Date')
+        self.assertEqual(nodes.etype_from_pyobj(datetime.now()), 'Datetime')
+        self.assertEqual(nodes.etype_from_pyobj(date.today()), 'Date')
 
     def test_string(self):
-        self.assertEquals(nodes.etype_from_pyobj('hop'), 'String')
-        self.assertEquals(nodes.etype_from_pyobj(u'hop'), 'String')
+        self.assertEqual(nodes.etype_from_pyobj('hop'), 'String')
+        self.assertEqual(nodes.etype_from_pyobj(u'hop'), 'String')
 
 
 class NodesTest(TestCase):
@@ -61,11 +61,11 @@
         tree.check_references()
         if normrql is None:
             normrql = rql
-        self.assertEquals(tree.as_string(), normrql)
+        self.assertEqual(tree.as_string(), normrql)
         # just check repr() doesn't raise an exception
         repr(tree)
         copy = tree.copy()
-        self.assertEquals(copy.as_string(), normrql)
+        self.assertEqual(copy.as_string(), normrql)
         copy.check_references()
         return tree
 
@@ -77,9 +77,9 @@
         #del d1['parent']; del d1['children'] # parent and children are slots now
         #d2 = tree2.__dict__.copy()
         #del d2['parent']; del d2['children']
-        self.assertNotEquals(id(tree1), id(tree2))
+        self.assertNotEqual(id(tree1), id(tree2))
         self.assert_(tree1.is_equivalent(tree2))
-        #self.assertEquals(len(tree1.children), len(tree2.children))
+        #self.assertEqual(len(tree1.children), len(tree2.children))
         #for i in range(len(tree1.children)):
         #    self.check_equal_but_not_same(tree1.children[i], tree2.children[i])
 
@@ -93,22 +93,22 @@
         self.assertRaises(BadRQLQuery, tree.set_limit, '1')
         tree.save_state()
         tree.set_limit(10)
-        self.assertEquals(select.limit, 10)
-        self.assertEquals(tree.as_string(), 'Any X LIMIT 10 WHERE X is Person')
+        self.assertEqual(select.limit, 10)
+        self.assertEqual(tree.as_string(), 'Any X LIMIT 10 WHERE X is Person')
         tree.recover()
-        self.assertEquals(select.limit, None)
-        self.assertEquals(tree.as_string(), 'Any X WHERE X is Person')
+        self.assertEqual(select.limit, None)
+        self.assertEqual(tree.as_string(), 'Any X WHERE X is Person')
 
     def test_union_set_limit_2(self):
         # not undoable set_limit since a new root has to be introduced
         tree = self._parse("(Any X WHERE X is Person) UNION (Any X WHERE X is Company)")
         tree.save_state()
         tree.set_limit(10)
-        self.assertEquals(tree.as_string(), 'Any A LIMIT 10 WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
+        self.assertEqual(tree.as_string(), 'Any A LIMIT 10 WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
         select = tree.children[0]
-        self.assertEquals(select.limit, 10)
+        self.assertEqual(select.limit, 10)
         tree.recover()
-        self.assertEquals(tree.as_string(), '(Any X WHERE X is Person) UNION (Any X WHERE X is Company)')
+        self.assertEqual(tree.as_string(), '(Any X WHERE X is Person) UNION (Any X WHERE X is Company)')
 
     def test_union_set_offset_1(self):
         tree = self._parse("Any X WHERE X is Person")
@@ -117,10 +117,10 @@
         self.assertRaises(BadRQLQuery, tree.set_offset, '1')
         tree.save_state()
         tree.set_offset(10)
-        self.assertEquals(select.offset, 10)
+        self.assertEqual(select.offset, 10)
         tree.recover()
-        self.assertEquals(select.offset, 0)
-        self.assertEquals(tree.as_string(), 'Any X WHERE X is Person')
+        self.assertEqual(select.offset, 0)
+        self.assertEqual(tree.as_string(), 'Any X WHERE X is Person')
 
     def test_union_set_offset_2(self):
         # not undoable set_offset since a new root has to be introduced
@@ -128,10 +128,10 @@
         tree.save_state()
         tree.set_offset(10)
         select = tree.children[0]
-        self.assertEquals(tree.as_string(), 'Any A OFFSET 10 WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
-        self.assertEquals(select.offset, 10)
+        self.assertEqual(tree.as_string(), 'Any A OFFSET 10 WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
+        self.assertEqual(select.offset, 10)
         tree.recover()
-        self.assertEquals(tree.as_string(), '(Any X WHERE X is Person) UNION (Any X WHERE X is Company)')
+        self.assertEqual(tree.as_string(), '(Any X WHERE X is Person) UNION (Any X WHERE X is Company)')
 
     def test_union_undo_add_rel(self):
         tree = self._parse("Any A WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))")
@@ -140,34 +140,34 @@
         var = select.make_variable()
         mainvar = select.selection[0].variable
         select.add_relation(mainvar, 'name', var)
-        self.assertEquals(tree.as_string(), 'Any A WHERE A name B WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
+        self.assertEqual(tree.as_string(), 'Any A WHERE A name B WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
         tree.recover()
-        self.assertEquals(tree.as_string(), 'Any A WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
+        self.assertEqual(tree.as_string(), 'Any A WITH A BEING ((Any X WHERE X is Person) UNION (Any X WHERE X is Company))')
 
     def test_select_set_limit(self):
         tree = self._simpleparse("Any X WHERE X is Person")
-        self.assertEquals(tree.limit, None)
+        self.assertEqual(tree.limit, None)
         self.assertRaises(BadRQLQuery, tree.set_limit, 0)
         self.assertRaises(BadRQLQuery, tree.set_limit, -1)
         self.assertRaises(BadRQLQuery, tree.set_limit, '1')
         tree.save_state()
         tree.set_limit(10)
-        self.assertEquals(tree.limit, 10)
+        self.assertEqual(tree.limit, 10)
         tree.recover()
-        self.assertEquals(tree.limit, None)
+        self.assertEqual(tree.limit, None)
 
     def test_select_set_offset(self):
         tree = self._simpleparse("Any X WHERE X is Person")
         self.assertRaises(BadRQLQuery, tree.set_offset, -1)
         self.assertRaises(BadRQLQuery, tree.set_offset, '1')
-        self.assertEquals(tree.offset, 0)
+        self.assertEqual(tree.offset, 0)
         tree.save_state()
         tree.set_offset(0)
-        self.assertEquals(tree.offset, 0)
+        self.assertEqual(tree.offset, 0)
         tree.set_offset(10)
-        self.assertEquals(tree.offset, 10)
+        self.assertEqual(tree.offset, 10)
         tree.recover()
-        self.assertEquals(tree.offset, 0)
+        self.assertEqual(tree.offset, 0)
 
     def test_select_add_sort_var(self):
         tree = self._parse('Any X')
@@ -175,10 +175,10 @@
         select = tree.children[0]
         select.add_sort_var(select.get_variable('X'))
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X ORDERBY X')
+        self.assertEqual(tree.as_string(), 'Any X ORDERBY X')
         tree.recover()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X')
+        self.assertEqual(tree.as_string(), 'Any X')
 
     def test_select_remove_sort_terms(self):
         tree = self._parse('Any X,Y ORDERBY X,Y')
@@ -186,10 +186,10 @@
         select = tree.children[0]
         select.remove_sort_terms()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X,Y')
+        self.assertEqual(tree.as_string(), 'Any X,Y')
         tree.recover()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X,Y ORDERBY X,Y')
+        self.assertEqual(tree.as_string(), 'Any X,Y ORDERBY X,Y')
 
     def test_select_undefine_variable(self):
         tree = sparse('Any X,Y ORDERBY X,Y WHERE X work_for Y')
@@ -210,16 +210,16 @@
         tree = self._parse('DISTINCT Any X')
         tree.save_state()
         select = tree.children[0]
-        self.assertEquals(select.distinct, True)
+        self.assertEqual(select.distinct, True)
         tree.save_state()
         select.set_distinct(True)
-        self.assertEquals(select.distinct, True)
+        self.assertEqual(select.distinct, True)
         tree.recover()
-        self.assertEquals(select.distinct, True)
+        self.assertEqual(select.distinct, True)
         select.set_distinct(False)
-        self.assertEquals(select.distinct, False)
+        self.assertEqual(select.distinct, False)
         tree.recover()
-        self.assertEquals(select.distinct, True)
+        self.assertEqual(select.distinct, True)
 
     def test_select_add_group_var(self):
         tree = self._parse('Any X')
@@ -227,10 +227,10 @@
         select = tree.children[0]
         select.add_group_var(select.get_variable('X'))
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X GROUPBY X')
+        self.assertEqual(tree.as_string(), 'Any X GROUPBY X')
         tree.recover()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X')
+        self.assertEqual(tree.as_string(), 'Any X')
 
     def test_select_remove_group_var(self):
         tree = self._parse('Any X GROUPBY X')
@@ -238,10 +238,10 @@
         select = tree.children[0]
         select.remove_group_var(select.groupby[0])
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X')
+        self.assertEqual(tree.as_string(), 'Any X')
         tree.recover()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X GROUPBY X')
+        self.assertEqual(tree.as_string(), 'Any X GROUPBY X')
 
     def test_select_remove_groups(self):
         tree = self._parse('Any X,Y GROUPBY X,Y')
@@ -249,10 +249,10 @@
         select = tree.children[0]
         select.remove_groups()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X,Y')
+        self.assertEqual(tree.as_string(), 'Any X,Y')
         tree.recover()
         tree.check_references()
-        self.assertEquals(tree.as_string(), 'Any X,Y GROUPBY X,Y')
+        self.assertEqual(tree.as_string(), 'Any X,Y GROUPBY X,Y')
 
     def test_select_base_1(self):
         tree = self._parse("Any X WHERE X is Person")
@@ -367,34 +367,34 @@
     def test_selected_index(self):
         tree = self._simpleparse("Any X ORDERBY N DESC WHERE X is Person, X name N")
         annotator.annotate(tree)
-        self.assertEquals(tree.defined_vars['X'].selected_index(), 0)
-        self.assertEquals(tree.defined_vars['N'].selected_index(), None)
+        self.assertEqual(tree.defined_vars['X'].selected_index(), 0)
+        self.assertEqual(tree.defined_vars['N'].selected_index(), None)
 
     def test_get_variable_indices_1(self):
         dummy = self._parse("Any A,B,C")
         dummy.children[0].solutions = [{'A': 'String', 'B': 'EUser', 'C': 'EGroup'},
                                        {'A': 'String', 'B': 'Personne', 'C': 'EGroup'},
                                        {'A': 'String', 'B': 'EUser', 'C': 'Societe'}]
-        self.assertEquals(dummy.get_variable_indices(), set([1, 2]))
+        self.assertEqual(dummy.get_variable_indices(), set([1, 2]))
 
     def test_get_variable_indices_2(self):
         dummy = self._parse("Any A,B WHERE B relation C")
         dummy.children[0].solutions = [{'A': 'String', 'B': 'EUser', 'C': 'EGroup'},
                                        {'A': 'String', 'B': 'Personne', 'C': 'EGroup'},
                                        {'A': 'String', 'B': 'EUser', 'C': 'Societe'}]
-        self.assertEquals(dummy.get_variable_indices(), set([1]))
+        self.assertEqual(dummy.get_variable_indices(), set([1]))
 
     def test_get_variable_indices_3(self):
         dummy = self._parse("(Any X WHERE X is EGroup) UNION (Any C WHERE C is EUser)")
         dummy.children[0].solutions = [{'X': 'EGroup'}]
         dummy.children[1].solutions = [{'C': 'EUser'}]
-        self.assertEquals(dummy.get_variable_indices(), set([0]))
+        self.assertEqual(dummy.get_variable_indices(), set([0]))
 
     def test_get_variable_indices_4(self):
         dummy = self._parse("(Any X,XN WHERE X is EGroup, X name XN) UNION (Any C,CL WHERE C is EUser, C login CL)")
         dummy.children[0].solutions = [{'X': 'EGroup', 'XN': 'String'}]
         dummy.children[1].solutions = [{'C': 'EUser', 'CL': 'String'}]
-        self.assertEquals(dummy.get_variable_indices(), set([0]))
+        self.assertEqual(dummy.get_variable_indices(), set([0]))
 
     # insertion tests #########################################################
 
@@ -473,40 +473,40 @@
 
     def test_as_string(self):
         tree = parse("SET X know Y WHERE X friend Y;")
-        self.assertEquals(tree.as_string(), 'SET X know Y WHERE X friend Y')
+        self.assertEqual(tree.as_string(), 'SET X know Y WHERE X friend Y')
 
         tree = parse("Person X")
-        self.assertEquals(tree.as_string(),
+        self.assertEqual(tree.as_string(),
                           'Any X WHERE X is Person')
 
         tree = parse(u"Any X WHERE X has_text 'héhé'")
-        self.assertEquals(tree.as_string('utf8'),
+        self.assertEqual(tree.as_string('utf8'),
                           u'Any X WHERE X has_text "héhé"'.encode('utf8'))
         tree = parse(u"Any X WHERE X has_text %(text)s")
-        self.assertEquals(tree.as_string('utf8', {'text': u'héhé'}),
+        self.assertEqual(tree.as_string('utf8', {'text': u'héhé'}),
                           u'Any X WHERE X has_text "héhé"'.encode('utf8'))
         tree = parse(u"Any X WHERE X has_text %(text)s")
-        self.assertEquals(tree.as_string('utf8', {'text': u'hé"hé'}),
+        self.assertEqual(tree.as_string('utf8', {'text': u'hé"hé'}),
                           u'Any X WHERE X has_text "hé\\"hé"'.encode('utf8'))
         tree = parse(u"Any X WHERE X has_text %(text)s")
-        self.assertEquals(tree.as_string('utf8', {'text': u'hé"\'hé'}),
+        self.assertEqual(tree.as_string('utf8', {'text': u'hé"\'hé'}),
                           u'Any X WHERE X has_text "hé\\"\'hé"'.encode('utf8'))
 
     def test_as_string_no_encoding(self):
         tree = parse(u"Any X WHERE X has_text 'héhé'")
-        self.assertEquals(tree.as_string(),
+        self.assertEqual(tree.as_string(),
                           u'Any X WHERE X has_text "héhé"')
         tree = parse(u"Any X WHERE X has_text %(text)s")
-        self.assertEquals(tree.as_string(kwargs={'text': u'héhé'}),
+        self.assertEqual(tree.as_string(kwargs={'text': u'héhé'}),
                           u'Any X WHERE X has_text "héhé"')
 
     def test_as_string_now_today_null(self):
         tree = parse(u"Any X WHERE X name NULL")
-        self.assertEquals(tree.as_string(), 'Any X WHERE X name NULL')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X name NULL')
         tree = parse(u"Any X WHERE X creation_date NOW")
-        self.assertEquals(tree.as_string(), 'Any X WHERE X creation_date NOW')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X creation_date NOW')
         tree = parse(u"Any X WHERE X creation_date TODAY")
-        self.assertEquals(tree.as_string(), 'Any X WHERE X creation_date TODAY')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X creation_date TODAY')
 
     # sub-queries tests #######################################################
 
@@ -519,19 +519,19 @@
         select.recover()
         X = select.get_variable('X')
         N = select.get_variable('N')
-        self.assertEquals(len(X.references()), 3)
-        self.assertEquals(len(N.references()), 2)
+        self.assertEqual(len(X.references()), 3)
+        self.assertEqual(len(N.references()), 2)
         tree.schema = schema
         #annotator.annotate(tree)
         # XXX how to choose
-        self.assertEquals(X.get_type(), 'Company')
-        self.assertEquals(X.get_type({'X': 'Person'}), 'Person')
-        #self.assertEquals(N.get_type(), 'String')
-        self.assertEquals(X.get_description(0, lambda x:x), 'Company, Person, Student')
-        self.assertEquals(N.get_description(0, lambda x:x), 'firstname, name')
-        self.assertEquals(X.selected_index(), 0)
-        self.assertEquals(N.selected_index(), None)
-        self.assertEquals(X.main_relation(), None)
+        self.assertEqual(X.get_type(), 'Company')
+        self.assertEqual(X.get_type({'X': 'Person'}), 'Person')
+        #self.assertEqual(N.get_type(), 'String')
+        self.assertEqual(X.get_description(0, lambda x:x), 'Company, Person, Student')
+        self.assertEqual(N.get_description(0, lambda x:x), 'firstname, name')
+        self.assertEqual(X.selected_index(), 0)
+        self.assertEqual(N.selected_index(), None)
+        self.assertEqual(X.main_relation(), None)
 
     # non regression tests ####################################################
 
@@ -569,33 +569,33 @@
     def test_known_values_1(self):
         tree = parse('Any X where X name "turlututu"').children[0]
         constants = tree.get_nodes(nodes.Constant)
-        self.assertEquals(len(constants), 1)
-        self.assertEquals(isinstance(constants[0], nodes.Constant), 1)
-        self.assertEquals(constants[0].value, 'turlututu')
+        self.assertEqual(len(constants), 1)
+        self.assertEqual(isinstance(constants[0], nodes.Constant), 1)
+        self.assertEqual(constants[0].value, 'turlututu')
 
     def test_known_values_2(self):
         tree = parse('Any X where X name "turlututu", Y know X, Y name "chapo pointu"').children[0]
         varrefs = tree.get_nodes(nodes.VariableRef)
-        self.assertEquals(len(varrefs), 5)
+        self.assertEqual(len(varrefs), 5)
         for varref in varrefs:
             self.assertIsInstance(varref, nodes.VariableRef)
-        self.assertEquals(sorted(x.name for x in varrefs),
+        self.assertEqual(sorted(x.name for x in varrefs),
                           ['X', 'X', 'X', 'Y', 'Y'])
 
     def test_iknown_values_1(self):
         tree = parse('Any X where X name "turlututu"').children[0]
         constants = list(tree.iget_nodes(nodes.Constant))
-        self.assertEquals(len(constants), 1)
-        self.assertEquals(isinstance(constants[0], nodes.Constant), 1)
-        self.assertEquals(constants[0].value, 'turlututu')
+        self.assertEqual(len(constants), 1)
+        self.assertEqual(isinstance(constants[0], nodes.Constant), 1)
+        self.assertEqual(constants[0].value, 'turlututu')
 
     def test_iknown_values_2(self):
         tree = parse('Any X where X name "turlututu", Y know X, Y name "chapo pointu"').children[0]
         varrefs = list(tree.iget_nodes(nodes.VariableRef))
-        self.assertEquals(len(varrefs), 5)
+        self.assertEqual(len(varrefs), 5)
         for varref in varrefs:
             self.assertIsInstance(varref, nodes.VariableRef)
-        self.assertEquals(sorted(x.name for x in varrefs),
+        self.assertEqual(sorted(x.name for x in varrefs),
                           ['X', 'X', 'X', 'Y', 'Y'])
 
 if __name__ == '__main__':
--- a/test/unittest_parser.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_parser.py	Mon Oct 11 11:33:36 2010 +0200
@@ -179,7 +179,7 @@
         comparison = base.children[1]
         self.failUnless(isinstance(comparison, nodes.Comparison))
         rhs = comparison.children[0]
-        self.assertEquals(type(rhs.value), unicode)
+        self.assertEqual(type(rhs.value), unicode)
 
     def test_precedence_1(self):
         tree = self.parse("Any X WHERE X firstname 'lulu' AND X name 'toto' OR X name 'tutu';")
@@ -272,22 +272,22 @@
         tree = self.parse("Any X WHERE X firstname %(firstname)s;")
         cste = tree.children[0].where.children[1].children[0]
         self.assert_(isinstance(cste, nodes.Constant))
-        self.assertEquals(cste.type, 'Substitute')
-        self.assertEquals(cste.value, 'firstname')
+        self.assertEqual(cste.type, 'Substitute')
+        self.assertEqual(cste.value, 'firstname')
 
     def test_optional_relation(self):
         tree = self.parse(r'Any X WHERE X related Y;')
         related = tree.children[0].where
-        self.assertEquals(related.optional, None)
+        self.assertEqual(related.optional, None)
         tree = self.parse(r'Any X WHERE X? related Y;')
         related = tree.children[0].where
-        self.assertEquals(related.optional, 'left')
+        self.assertEqual(related.optional, 'left')
         tree = self.parse(r'Any X WHERE X related Y?;')
         related = tree.children[0].where
-        self.assertEquals(related.optional, 'right')
+        self.assertEqual(related.optional, 'right')
         tree = self.parse(r'Any X WHERE X? related Y?;')
         related = tree.children[0].where
-        self.assertEquals(related.optional, 'both')
+        self.assertEqual(related.optional, 'both')
 
     def test_exists(self):
         tree = self.parse("Any X WHERE X firstname 'lulu',"
@@ -301,9 +301,9 @@
 
     def test_etype(self):
         tree = self.parse('EmailAddress X;')
-        self.assertEquals(tree.as_string(), 'Any X WHERE X is EmailAddress')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X is EmailAddress')
         tree = self.parse('EUser X;')
-        self.assertEquals(tree.as_string(), 'Any X WHERE X is EUser')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X is EUser')
 
     def test_spec(self):
         """test all RQL string found in the specification and test they are well parsed"""
--- a/test/unittest_rqlgen.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_rqlgen.py	Mon Oct 11 11:33:36 2010 +0200
@@ -41,21 +41,21 @@
         """tests select with entity type only
         """
         rql = self.rql_generator.select('Person')
-        self.assertEquals(rql, 'Person X')
+        self.assertEqual(rql, 'Person X')
         
 
     def test_select_group(self):
         """tests select with group
         """
         rql = self.rql_generator.select('Person', groups=('X',))
-        self.assertEquals(rql, 'Person X\nGROUPBY X')
+        self.assertEqual(rql, 'Person X\nGROUPBY X')
 
 
     def test_select_sort(self):
         """tests select with sort
         """
         rql = self.rql_generator.select('Person', sorts=('X ASC',))
-        self.assertEquals(rql, 'Person X\nSORTBY X ASC')
+        self.assertEqual(rql, 'Person X\nSORTBY X ASC')
 
 
     def test_select(self):
@@ -68,7 +68,7 @@
                                           ('X','surname','S') ),
                                         ('X',),
                                         ('F ASC', 'S DESC'))
-        self.assertEquals(rql, 'Person X\nWHERE X work_for S , S name "Logilab"'
+        self.assertEqual(rql, 'Person X\nWHERE X work_for S , S name "Logilab"'
                           ' , X firstname F , X surname S\nGROUPBY X'
                           '\nSORTBY F ASC, S DESC')
                                         
@@ -80,7 +80,7 @@
                                          ('S','name','"Logilab"'),
                                          ('X','firstname','F'),
                                          ('X','surname','S') ) )
-        self.assertEquals(rql, 'WHERE X work_for S , S name "Logilab" '
+        self.assertEqual(rql, 'WHERE X work_for S , S name "Logilab" '
                           ', X firstname F , X surname S')
 
 
@@ -88,14 +88,14 @@
         """tests the groupby() method behaviour
         """
         rql = self.rql_generator.groupby(('F', 'S'))
-        self.assertEquals(rql, 'GROUPBY F, S')
+        self.assertEqual(rql, 'GROUPBY F, S')
         
 
     def test_sortby(self):
         """tests the sortby() method behaviour
         """
         rql = self.rql_generator.sortby(('F ASC', 'S DESC'))
-        self.assertEquals(rql, 'SORTBY F ASC, S DESC')
+        self.assertEqual(rql, 'SORTBY F ASC, S DESC')
         
 
     def test_insert(self):
@@ -103,7 +103,7 @@
         """
         rql = self.rql_generator.insert('Person', (('firstname', "Clark"),
                                                    ('lastname', "Kent")))
-        self.assertEquals(rql, 'INSERT Person X: X firstname "Clark",'
+        self.assertEqual(rql, 'INSERT Person X: X firstname "Clark",'
                           ' X lastname "Kent"')
         
         
@@ -115,7 +115,7 @@
                                          ('lastname', "Kent")),
                                         (('job', "superhero"),
                                          ('nick', "superman")))
-        self.assertEquals(rql, 'SET X job "superhero", X nick "superman" '
+        self.assertEqual(rql, 'SET X job "superhero", X nick "superman" '
                           'WHERE X is "Person", X firstname "Clark", X '
                           'lastname "Kent"')
 
@@ -126,7 +126,7 @@
         rql = self.rql_generator.delete('Person',
                                         (('firstname', "Clark"),
                                          ('lastname', "Kent")))
-        self.assertEquals(rql, 'DELETE Person X where X firstname "Clark", '
+        self.assertEqual(rql, 'DELETE Person X where X firstname "Clark", '
                           'X lastname "Kent"')
         
 if __name__ == '__main__':
--- a/test/unittest_stcheck.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_stcheck.py	Mon Oct 11 11:33:36 2010 +0200
@@ -109,7 +109,7 @@
     def _test_rewrite(self, rql, expected):
         rqlst = self.parse(rql)
         self.simplify(rqlst)
-        self.assertEquals(rqlst.as_string(), expected)
+        self.assertEqual(rqlst.as_string(), expected)
 
     def test_rewrite(self):
         for rql, expected in (
@@ -194,20 +194,20 @@
                             'VC work_for S, S name "draft" '
                             'WITH VF, VC, VCD BEING (Any VF, MAX(VC), VCD GROUPBY VF, VCD '
                             '                        WHERE VC connait VF, VC creation_date VCD)'))
-        self.assertEquals(rqlst.children[0].vargraph,
+        self.assertEqual(rqlst.children[0].vargraph,
                           {'VCD': ['VC'], 'VF': ['VC'], 'S': ['VC'], 'VC': ['S', 'VF', 'VCD'],
                            ('VC', 'S'): 'work_for',
                            ('VC', 'VF'): 'connait',
                            ('VC', 'VCD'): 'creation_date'})
-        self.assertEquals(rqlst.children[0].aggregated, set(('VC',)))
+        self.assertEqual(rqlst.children[0].aggregated, set(('VC',)))
 
 
 ##     def test_rewriten_as_string(self):
 ##         rqlst = self.parse('Any X WHERE X eid 12')
-##         self.assertEquals(rqlst.as_string(), 'Any X WHERE X eid 12')
+##         self.assertEqual(rqlst.as_string(), 'Any X WHERE X eid 12')
 ##         rqlst = rqlst.copy()
 ##         self.annotate(rqlst)
-##         self.assertEquals(rqlst.as_string(), 'Any X WHERE X eid 12')
+##         self.assertEqual(rqlst.as_string(), 'Any X WHERE X eid 12')
 
 class CopyTest(TestCase):
 
@@ -230,7 +230,7 @@
         root = self.parse('Any X,U WHERE C owned_by U, NOT X owned_by U, X eid 1, C eid 2')
         self.simplify(root)
         stmt = root.children[0]
-        self.assertEquals(stmt.defined_vars['U'].valuable_references(), 3)
+        self.assertEqual(stmt.defined_vars['U'].valuable_references(), 3)
         copy = stmts.Select()
         copy.append_selected(stmt.selection[0].copy(copy))
         copy.append_selected(stmt.selection[1].copy(copy))
@@ -239,8 +239,8 @@
         newroot.append(copy)
         self.annotate(newroot)
         self.simplify(newroot)
-        self.assertEquals(newroot.as_string(), 'Any 1,U WHERE 2 owned_by U, NOT EXISTS(1 owned_by U)')
-        self.assertEquals(copy.defined_vars['U'].valuable_references(), 3)
+        self.assertEqual(newroot.as_string(), 'Any 1,U WHERE 2 owned_by U, NOT EXISTS(1 owned_by U)')
+        self.assertEqual(copy.defined_vars['U'].valuable_references(), 3)
 
 
 class AnnotateTest(TestCase):
@@ -261,42 +261,42 @@
         rqlst = self.parse('Any X WHERE C is Company, EXISTS(X work_for C)').children[0]
         C = rqlst.defined_vars['C']
         self.failIf(C.scope is rqlst, C.scope)
-        self.assertEquals(len(C.stinfo['relations']), 1)
+        self.assertEqual(len(C.stinfo['relations']), 1)
 
     def test_is_rel_no_scope_2(self):
         rqlst = self.parse('Any X, ET WHERE C is ET, EXISTS(X work_for C)').children[0]
         C = rqlst.defined_vars['C']
         self.failUnless(C.scope is rqlst, C.scope)
-        self.assertEquals(len(C.stinfo['relations']), 2)
+        self.assertEqual(len(C.stinfo['relations']), 2)
 
 
     def test_not_rel_normalization_1(self):
         rqlst = self.parse('Any X WHERE C is Company, NOT X work_for C').children[0]
-        self.assertEquals(rqlst.as_string(), 'Any X WHERE C is Company, NOT EXISTS(X work_for C)')
+        self.assertEqual(rqlst.as_string(), 'Any X WHERE C is Company, NOT EXISTS(X work_for C)')
         C = rqlst.defined_vars['C']
         self.failIf(C.scope is rqlst, C.scope)
 
     def test_not_rel_normalization_2(self):
         rqlst = self.parse('Any X, ET WHERE C is ET, NOT X work_for C').children[0]
-        self.assertEquals(rqlst.as_string(), 'Any X,ET WHERE C is ET, NOT EXISTS(X work_for C)')
+        self.assertEqual(rqlst.as_string(), 'Any X,ET WHERE C is ET, NOT EXISTS(X work_for C)')
         C = rqlst.defined_vars['C']
         self.failUnless(C.scope is rqlst, C.scope)
 
     def test_not_rel_normalization_3(self):
         rqlst = self.parse('Any X WHERE C is Company, X work_for C, NOT C name "World Company"').children[0]
-        self.assertEquals(rqlst.as_string(), "Any X WHERE C is Company, X work_for C, NOT C name 'World Company'")
+        self.assertEqual(rqlst.as_string(), "Any X WHERE C is Company, X work_for C, NOT C name 'World Company'")
         C = rqlst.defined_vars['C']
         self.failUnless(C.scope is rqlst, C.scope)
 
     def test_not_rel_normalization_4(self):
         rqlst = self.parse('Any X WHERE C is Company, NOT (X work_for C, C name "World Company")').children[0]
-        self.assertEquals(rqlst.as_string(), "Any X WHERE C is Company, NOT EXISTS(X work_for C, C name 'World Company')")
+        self.assertEqual(rqlst.as_string(), "Any X WHERE C is Company, NOT EXISTS(X work_for C, C name 'World Company')")
         C = rqlst.defined_vars['C']
         self.failIf(C.scope is rqlst, C.scope)
 
     def test_not_rel_normalization_5(self):
         rqlst = self.parse('Any X WHERE X work_for C, EXISTS(C identity D, NOT Y work_for D, D name "World Company")').children[0]
-        self.assertEquals(rqlst.as_string(), "Any X WHERE X work_for C, EXISTS(C identity D, NOT EXISTS(Y work_for D), D name 'World Company')")
+        self.assertEqual(rqlst.as_string(), "Any X WHERE X work_for C, EXISTS(C identity D, NOT EXISTS(Y work_for D), D name 'World Company')")
         D = rqlst.defined_vars['D']
         self.failIf(D.scope is rqlst, D.scope)
         self.failUnless(D.scope.parent.scope is rqlst, D.scope.parent.scope)
@@ -305,13 +305,13 @@
         rqlst = self.parse('Any X WITH X BEING (Any X WHERE C is Company, EXISTS(X work_for C))').children[0]
         C = rqlst.with_[0].query.children[0].defined_vars['C']
         self.failIf(C.scope is rqlst, C.scope)
-        self.assertEquals(len(C.stinfo['relations']), 1)
+        self.assertEqual(len(C.stinfo['relations']), 1)
 
     def test_subquery_annotation_2(self):
         rqlst = self.parse('Any X,ET WITH X,ET BEING (Any X, ET WHERE C is ET, EXISTS(X work_for C))').children[0]
         C = rqlst.with_[0].query.children[0].defined_vars['C']
         self.failUnless(C.scope is rqlst.with_[0].query.children[0], C.scope)
-        self.assertEquals(len(C.stinfo['relations']), 2)
+        self.assertEqual(len(C.stinfo['relations']), 2)
 
 if __name__ == '__main__':
     unittest_main()
--- a/test/unittest_utils.py	Mon Oct 11 11:33:19 2010 +0200
+++ b/test/unittest_utils.py	Mon Oct 11 11:33:36 2010 +0200
@@ -55,19 +55,19 @@
 
     def test_rqlvar_maker(self):
         varlist = list(utils.rqlvar_maker(27))
-        self.assertEquals(varlist, list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') + ['AA'])
+        self.assertEqual(varlist, list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') + ['AA'])
         varlist = list(utils.rqlvar_maker(27*26+1))
-        self.assertEquals(varlist[-2], 'ZZ')
-        self.assertEquals(varlist[-1], 'AAA')
+        self.assertEqual(varlist[-2], 'ZZ')
+        self.assertEqual(varlist[-1], 'AAA')
 
     def test_rqlvar_maker_dontstop(self):
         varlist = utils.rqlvar_maker()
-        self.assertEquals(varlist.next(), 'A')
-        self.assertEquals(varlist.next(), 'B')
+        self.assertEqual(varlist.next(), 'A')
+        self.assertEqual(varlist.next(), 'B')
         for i in range(24):
             varlist.next()
-        self.assertEquals(varlist.next(), 'AA')
-        self.assertEquals(varlist.next(), 'AB')
+        self.assertEqual(varlist.next(), 'AA')
+        self.assertEqual(varlist.next(), 'AB')
 
         
 if __name__ == '__main__':