Using assertIsNone() instead of assertEqual(None)
Following OpenStack Style Guidelines[1]: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises [H203] Unit test assertions tend to give better messages for more specific assertions. As a result, assertIsNone(...) is preferred over assertEqual(...,None) Change-Id: I83fc81bb7ea91fe63e881f49b2347ff39b9c51e7
This commit is contained in:
@@ -290,7 +290,7 @@ class NeutronSimpleDvsTest(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
self.assertEqual(True, updated_net['shared'])
|
self.assertEqual(True, updated_net['shared'])
|
||||||
|
|
||||||
# Update the description attribute
|
# Update the description attribute
|
||||||
self.assertEqual(None, network['description'])
|
self.assertIsNone(network['description'])
|
||||||
updated_net = self._plugin.update_network(
|
updated_net = self._plugin.update_network(
|
||||||
ctx, id,
|
ctx, id,
|
||||||
{'network': {'description': 'test'}})
|
{'network': {'description': 'test'}})
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
|
|||||||
self.assertEqual("respool", az.resource_pool)
|
self.assertEqual("respool", az.resource_pool)
|
||||||
self.assertEqual("datastore", az.datastore_id)
|
self.assertEqual("datastore", az.datastore_id)
|
||||||
self.assertEqual(True, az.edge_ha)
|
self.assertEqual(True, az.edge_ha)
|
||||||
self.assertEqual(None, az.ha_datastore_id)
|
self.assertIsNone(az.ha_datastore_id)
|
||||||
|
|
||||||
def test_availability_zone_without_edge_ha(self):
|
def test_availability_zone_without_edge_ha(self):
|
||||||
az = nsx_az.ConfiguredAvailabilityZone(
|
az = nsx_az.ConfiguredAvailabilityZone(
|
||||||
@@ -46,7 +46,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
|
|||||||
self.assertEqual("respool", az.resource_pool)
|
self.assertEqual("respool", az.resource_pool)
|
||||||
self.assertEqual("datastore", az.datastore_id)
|
self.assertEqual("datastore", az.datastore_id)
|
||||||
self.assertEqual(False, az.edge_ha)
|
self.assertEqual(False, az.edge_ha)
|
||||||
self.assertEqual(None, az.ha_datastore_id)
|
self.assertIsNone(az.ha_datastore_id)
|
||||||
|
|
||||||
def test_availability_fail_long_name(self):
|
def test_availability_fail_long_name(self):
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
|
|||||||
@@ -294,4 +294,4 @@ class TestNsxvFlowClassifierDriver(
|
|||||||
self.assertTrue(mock_update_section.called)
|
self.assertTrue(mock_update_section.called)
|
||||||
section = mock_update_section.call_args[0][0]
|
section = mock_update_section.call_args[0][0]
|
||||||
# make sure the rule is not there
|
# make sure the rule is not there
|
||||||
self.assertEqual(None, section.find('rule'))
|
self.assertIsNone(section.find('rule'))
|
||||||
|
|||||||
Reference in New Issue
Block a user