[test] replace deprecated TestCase.assert_
authorRémi Cardona <remi.cardona@free.fr>
Wed, 23 Jul 2014 08:30:38 +0200
changeset 743 75496cdceeae
parent 742 6a9b50b044d8
child 744 f66ac8ee424e
[test] replace deprecated TestCase.assert_
test/unittest_nodes.py
test/unittest_parser.py
--- a/test/unittest_nodes.py	Sun Jul 20 13:02:40 2014 +0200
+++ b/test/unittest_nodes.py	Wed Jul 23 08:30:38 2014 +0200
@@ -128,7 +128,7 @@
         #d2 = tree2.__dict__.copy()
         #del d2['parent']; del d2['children']
         self.assertNotEqual(id(tree1), id(tree2))
-        self.assert_(tree1.is_equivalent(tree2))
+        self.assertTrue(tree1.is_equivalent(tree2))
         #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])
@@ -332,13 +332,13 @@
         tree = self._parse("Any X WHERE X is Person")
         self.assertIsInstance(tree, stmts.Union)
         select = tree.children[0]
-        self.assertEqual(select.limit, None)
+        self.assertIsNone(select.limit)
         self.assertEqual(select.offset, 0)
         self.assertIsInstance(select, stmts.Select)
         self.assertEqual(select.distinct, False)
         self.assertEqual(len(select.children), 2)
-        self.assert_(select.children[0] is select.selection[0])
-        self.assert_(select.children[1] is select.where)
+        self.assertIs(select.children[0], select.selection[0])
+        self.assertIs(select.children[1], select.where)
         self.assertIsInstance(select.where, nodes.Relation)
 
     def test_select_base_2(self):
--- a/test/unittest_parser.py	Sun Jul 20 13:02:40 2014 +0200
+++ b/test/unittest_parser.py	Wed Jul 23 08:30:38 2014 +0200
@@ -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.assertTrue(isinstance(comparison, nodes.Comparison))
+        self.assertIsInstance(comparison, nodes.Comparison)
         rhs = comparison.children[0]
         self.assertEqual(type(rhs.value), unicode)
 
@@ -257,31 +257,31 @@
     def test_math_1(self):
         tree = self.parse(r'Any X WHERE X date (TODAY + 1);')
         math = tree.children[0].where.children[1].children[0]
-        self.assert_(isinstance(math, nodes.MathExpression))
+        self.assertIsInstance(math, nodes.MathExpression)
         self.assertEqual(math.operator, '+')
 
     def test_math_2(self):
         tree = self.parse(r'Any X WHERE X date (TODAY + 1 * 2);')
         math = tree.children[0].where.children[1].children[0]
-        self.assert_(isinstance(math, nodes.MathExpression))
+        self.assertIsInstance(math, nodes.MathExpression)
         self.assertEqual(math.operator, '+')
         math2 = math.children[1]
-        self.assert_(isinstance(math2, nodes.MathExpression))
+        self.assertIsInstance(math2, nodes.MathExpression)
         self.assertEqual(math2.operator, '*')
 
     def test_math_3(self):
         tree = self.parse(r'Any X WHERE X date (TODAY + 1) * 2;')
         math = tree.children[0].where.children[1].children[0]
-        self.assert_(isinstance(math, nodes.MathExpression))
+        self.assertIsInstance(math, nodes.MathExpression)
         self.assertEqual(math.operator, '*')
         math2 = math.children[0]
-        self.assert_(isinstance(math2, nodes.MathExpression))
+        self.assertIsInstance(math2, nodes.MathExpression)
         self.assertEqual(math2.operator, '+')
 
     def test_substitute(self):
         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.assertIsInstance(cste, nodes.Constant)
         self.assertEqual(cste.type, 'Substitute')
         self.assertEqual(cste.value, 'firstname')