Fix isinstance assertions

self.assertIsInstance is preferred over assert(isinstance(..)). See feedback in:
https://review.openstack.org/#/c/102754/1/neutron/tests/unit/test_extension_security_group.py

Change-Id: I9dd6141d8f25961eb42a390b45e6d94d482afc1c
This commit is contained in:
Ralf Haferkamp 2014-07-02 12:25:00 +02:00
parent 1ed9e7a342
commit a48f64d096
2 changed files with 5 additions and 7 deletions

View File

@ -1429,7 +1429,7 @@ class TestConvertIPPrefixToCIDR(base.BaseTestCase):
class TestConvertProtocol(base.BaseTestCase):
def test_convert_numeric_protocol(self):
assert(isinstance(ext_sg.convert_protocol('2'), str))
self.assertIsInstance(ext_sg.convert_protocol('2'), str)
def test_convert_bad_protocol(self):
for val in ['bad', '256', '-1']:

View File

@ -56,9 +56,8 @@ class NeutronManagerTestCase(base.BaseTestCase):
mgr = manager.NeutronManager.get_instance()
plugin = mgr.get_service_plugins()[constants.DUMMY]
self.assertTrue(
isinstance(plugin,
(dummy_plugin.DummyServicePlugin, types.ClassType)),
self.assertIsInstance(
plugin, (dummy_plugin.DummyServicePlugin, types.ClassType),
"loaded plugin should be of type neutronDummyPlugin")
def test_service_plugin_by_name_is_loaded(self):
@ -67,9 +66,8 @@ class NeutronManagerTestCase(base.BaseTestCase):
mgr = manager.NeutronManager.get_instance()
plugin = mgr.get_service_plugins()[constants.DUMMY]
self.assertTrue(
isinstance(plugin,
(dummy_plugin.DummyServicePlugin, types.ClassType)),
self.assertIsInstance(
plugin, (dummy_plugin.DummyServicePlugin, types.ClassType),
"loaded plugin should be of type neutronDummyPlugin")
def test_multiple_plugins_specified_for_service_type(self):