replace assertTrue with assertIs.

[H203] 'assertTrue' should also be avoided when 
more specific methods are available (assertIs instead of 
assertTrue), because they provide a better error message 
in case of failure.

Change-Id: I9dd9964591a2936882e815b31ec0dd1959825bc6
This commit is contained in:
zhouyunfeng 2016-12-16 16:10:52 +08:00 committed by yunfeng zhou
parent c46ff2b1ab
commit 52f6fe1142
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class ExceptionTestCase(unit.BaseTestCase):
self.assertIsNotNone(j['error'].get('message'))
self.assertNotIn('\n', j['error']['message'])
self.assertNotIn(' ', j['error']['message'])
self.assertTrue(type(j['error']['code']) is int)
self.assertIs(type(j['error']['code']), int)
def test_all_json_renderings(self):
"""Everything callable in the exception module should be renderable.

View File

@ -85,7 +85,7 @@ class LiveLDAPPoolIdentity(test_backend_ldap_pool.LdapPoolCommonTestMixin,
self.assertEqual(2, len(ldappool_cm))
self.assertTrue(c3.connected)
self.assertTrue(c3.active)
self.assertTrue(c3 is c2) # same connection is reused
self.assertIs(c3, c2) # same connection is reused
self.assertTrue(c2.active)
with _get_conn() as c4: # conn4
self.assertEqual(3, len(ldappool_cm))