[test] use assertIn / assertIsInstance stable
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 24 Oct 2013 12:56:20 +0200
branchstable
changeset 9312 88d40fbcc071
parent 9311 8833ead6f3e4
child 9313 95119045ffb5
[test] use assertIn / assertIsInstance
server/test/unittest_querier.py
--- a/server/test/unittest_querier.py	Fri Oct 25 11:58:06 2013 +0200
+++ b/server/test/unittest_querier.py	Thu Oct 24 12:56:20 2013 +0200
@@ -383,9 +383,9 @@
         self.execute("INSERT Personne X: X nom 'bidule'")[0]
         rset = self.execute('Any Y where X name TMP, Y nom in (TMP, "bidule")')
         #self.assertEqual(rset.description, [('Personne',), ('Personne',)])
-        self.assert_(('Personne',) in rset.description)
+        self.assertIn(('Personne',), rset.description)
         rset = self.execute('DISTINCT Any Y where X name TMP, Y nom in (TMP, "bidule")')
-        self.assert_(('Personne',) in rset.description)
+        self.assertIn(('Personne',), rset.description)
 
     def test_select_not_attr(self):
         peid = self.execute("INSERT Personne X: X nom 'bidule'")[0][0]
@@ -466,8 +466,8 @@
         self.execute("SET X tags Y WHERE X eid %(t)s, Y eid %(g)s",
                      {'g': geid, 't': teid})
         rset = self.execute("Any GN,TN ORDERBY GN WHERE T? tags G, T name TN, G name GN")
-        self.assertTrue(['users', 'tag'] in rset.rows)
-        self.assertTrue(['activated', None] in rset.rows)
+        self.assertIn(['users', 'tag'], rset.rows)
+        self.assertIn(['activated', None], rset.rows)
         rset = self.execute("Any GN,TN ORDERBY GN WHERE T tags G?, T name TN, G name GN")
         self.assertEqual(rset.rows, [[None, 'tagbis'], ['users', 'tag']])
 
@@ -818,11 +818,11 @@
         self.execute("INSERT Tag X: X name 'bidule', X creation_date NOW")
         self.execute("INSERT Tag Y: Y name 'toto'")
         rset = self.execute("Any D WHERE X name in ('bidule', 'toto') , X creation_date D")
-        self.assert_(isinstance(rset.rows[0][0], datetime), rset.rows)
+        self.assertIsInstance(rset.rows[0][0], datetime)
         rset = self.execute('Tag X WHERE X creation_date TODAY')
         self.assertEqual(len(rset.rows), 2)
         rset = self.execute('Any MAX(D) WHERE X is Tag, X creation_date D')
-        self.assertTrue(isinstance(rset[0][0], datetime), (rset[0][0], type(rset[0][0])))
+        self.assertIsInstance(rset[0][0], datetime)
 
     def test_today(self):
         self.execute("INSERT Tag X: X name 'bidule', X creation_date TODAY")