[test] replace some assert{True,False} with more specific method
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 04 Apr 2014 13:49:03 +0200
changeset 9638 3046bae3ce31
parent 9637 c6132d36e55d
child 9639 74b3db5bb41d
[test] replace some assert{True,False} with more specific method
test/unittest_entity.py
--- a/test/unittest_entity.py	Tue Apr 01 10:26:37 2014 +0200
+++ b/test/unittest_entity.py	Fri Apr 04 13:49:03 2014 +0200
@@ -514,7 +514,7 @@
             req.execute('SET X tags Y WHERE X is Tag, Y is Personne')
             e = req.execute('Any X WHERE X is Tag').get_entity(0, 0)
             unrelated = [r[0] for r in e.unrelated('tags', 'Personne', 'subject')]
-            self.assertFalse(p.eid in unrelated)
+            self.assertNotIn(p.eid, unrelated)
 
     def test_unrelated_limit(self):
         with self.admin_access.web_request() as req:
@@ -694,7 +694,7 @@
             p2 = req.create_entity('Personne', nom=u'toto')
             req.execute('SET X evaluee Y WHERE X nom "di mascio", Y nom "toto"')
             self.assertEqual(p1.evaluee[0].nom, "toto")
-            self.assertTrue(not p1.reverse_evaluee)
+            self.assertFalse(p1.reverse_evaluee)
 
     def test_complete_relation(self):
         with self.admin_access.repo_cnx() as session:
@@ -703,7 +703,7 @@
                 'WHERE U login "admin", S1 name "activated", S2 name "deactivated"')[0][0]
             trinfo = session.execute('Any X WHERE X eid %(x)s', {'x': eid}).get_entity(0, 0)
             trinfo.complete()
-            self.assertTrue(isinstance(trinfo.cw_attr_cache['creation_date'], datetime))
+            self.assertIsInstance(trinfo.cw_attr_cache['creation_date'], datetime)
             self.assertTrue(trinfo.cw_relation_cached('from_state', 'subject'))
             self.assertTrue(trinfo.cw_relation_cached('to_state', 'subject'))
             self.assertTrue(trinfo.cw_relation_cached('wf_info_for', 'subject'))
@@ -714,7 +714,7 @@
             user = req.execute('CWUser X WHERE X login "admin"').get_entity(0, 0)
             state = user.in_state[0]
             samestate = req.execute('State X WHERE X name "activated"').get_entity(0, 0)
-            self.assertTrue(state is samestate)
+            self.assertIs(state, samestate)
 
     def test_rest_path(self):
         with self.admin_access.web_request() as req: