drop unittest2 deprecation warnings stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 20 Feb 2012 11:07:36 +0100
branchstable
changeset 685 dd39f2652127
parent 684 2a175b352c78
child 686 9a61c1d4c3db
drop unittest2 deprecation warnings
test/unittest_parser.py
test/unittest_stcheck.py
--- a/test/unittest_parser.py	Mon Feb 20 11:06:12 2012 +0100
+++ b/test/unittest_parser.py	Mon Feb 20 11:07:36 2012 +0100
@@ -187,7 +187,7 @@
         tree = self.parse(u"Any X WHERE X name 'Ångström';")
         base = tree.children[0].where
         comparison = base.children[1]
-        self.failUnless(isinstance(comparison, nodes.Comparison))
+        self.assertTrue(isinstance(comparison, nodes.Comparison))
         rhs = comparison.children[0]
         self.assertEqual(type(rhs.value), unicode)
 
@@ -306,8 +306,8 @@
                          "Any X WHERE X firstname 'lulu', "
                          "EXISTS(X owned_by U, U in_group G, (G name 'lulufanclub') OR (G name 'managers'))")
         exists = tree.children[0].where.get_nodes(nodes.Exists)[0]
-        self.failUnless(exists.children[0].parent is exists)
-        self.failUnless(exists.parent)
+        self.assertTrue(exists.children[0].parent is exists)
+        self.assertTrue(exists.parent)
 
     def test_etype(self):
         tree = self.parse('EmailAddress X;')
--- a/test/unittest_stcheck.py	Mon Feb 20 11:06:12 2012 +0100
+++ b/test/unittest_stcheck.py	Mon Feb 20 11:07:36 2012 +0100
@@ -1,4 +1,4 @@
-# copyright 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2004-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of rql.
@@ -225,8 +225,8 @@
         self.simplify(tree)
         copy = tree.copy()
         exists = copy.get_nodes(nodes.Exists)[0]
-        self.failUnless(exists.children[0].parent is exists)
-        self.failUnless(exists.parent)
+        self.assertTrue(exists.children[0].parent is exists)
+        self.assertTrue(exists.parent)
 
     def test_copy_internals(self):
         root = self.parse('Any X,U WHERE C owned_by U, NOT X owned_by U, X eid 1, C eid 2')
@@ -254,7 +254,7 @@
 #     def test_simplified(self):
 #         rqlst = self.parse('Any L WHERE 5 name L')
 #         self.annotate(rqlst)
-#         self.failUnless(rqlst.defined_vars['L'].stinfo['attrvar'])
+#         self.assertTrue(rqlst.defined_vars['L'].stinfo['attrvar'])
 
     def test_is_rel_no_scope_1(self):
         """is relation used as type restriction should not affect variable's
@@ -262,13 +262,13 @@
         """
         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.assertFalse(C.scope is rqlst, C.scope)
         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.assertTrue(C.scope is rqlst, C.scope)
         self.assertEqual(len(C.stinfo['relations']), 2)
 
 
@@ -276,46 +276,46 @@
         rqlst = self.parse('Any X WHERE C is Company, NOT X work_for C').children[0]
         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)
+        self.assertFalse(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.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)
+        self.assertTrue(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.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)
+        self.assertTrue(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.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)
+        self.assertFalse(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.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)
+        self.assertFalse(D.scope is rqlst, D.scope)
+        self.assertTrue(D.scope.parent.scope is rqlst, D.scope.parent.scope)
 
     def test_subquery_annotation_1(self):
         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.assertFalse(C.scope is rqlst, C.scope)
         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.assertTrue(C.scope is rqlst.with_[0].query.children[0], C.scope)
         self.assertEqual(len(C.stinfo['relations']), 2)
         X = rqlst.get_variable('X')
-        self.failUnless(X.scope is rqlst, X.scope)
+        self.assertTrue(X.scope is rqlst, X.scope)
 
     def test_no_attr_var_if_uid_rel(self):
         with self.assertRaises(BadRQLQuery) as cm: