Use assertIsInstance/assertNotIsInstance in tests

This patch replaces assertTrue(isinstance(a, b))/assertFalse(isinstance(a, b))
by native assert function assertIsInstance/assertNotIsInstance.

Change-Id: I0183d57926ed9a4953dc6e66e5d081f008d857df
This commit is contained in:
Vasyl Saienko 2016-08-31 12:22:26 +03:00
parent f8f757a46d
commit a786c0244d
2 changed files with 7 additions and 9 deletions

View File

@ -239,10 +239,9 @@ class MigrationCheckersMixin(object):
self.assertIn('console_enabled', col_names)
# in some backends bool type is integer
self.assertTrue(isinstance(nodes.c.console_enabled.type,
sqlalchemy.types.Boolean) or
isinstance(nodes.c.console_enabled.type,
sqlalchemy.types.Integer))
self.assertIsInstance(nodes.c.console_enabled.type,
(sqlalchemy.types.Boolean,
sqlalchemy.types.Integer))
def _check_31baaf680d2b(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
@ -441,10 +440,9 @@ class MigrationCheckersMixin(object):
self.assertIsInstance(ports.c.portgroup_id.type,
sqlalchemy.types.Integer)
# in some backends bool type is integer
self.assertTrue(isinstance(ports.c.pxe_enabled.type,
sqlalchemy.types.Boolean) or
isinstance(ports.c.pxe_enabled.type,
sqlalchemy.types.Integer))
self.assertIsInstance(ports.c.pxe_enabled.type,
(sqlalchemy.types.Boolean,
sqlalchemy.types.Integer))
def _pre_upgrade_f6fdb920c182(self, engine):
# add some ports.

View File

@ -449,7 +449,7 @@ class TestObjectSerializer(test_base.TestCase):
primitive = ser.serialize_entity(self.context, thing)
self.assertEqual(1, len(primitive))
for item in primitive:
self.assertFalse(isinstance(item, base.IronicObject))
self.assertNotIsInstance(item, base.IronicObject)
thing2 = ser.deserialize_entity(self.context, primitive)
self.assertEqual(1, len(thing2))
for item in thing2: