From 0328373cfbf9b02e93838afa6c404bb829898967 Mon Sep 17 00:00:00 2001 From: melissaml Date: Sat, 26 Nov 2016 16:31:32 +0800 Subject: [PATCH] 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 --- vmware_nsx/tests/unit/dvs/test_plugin.py | 2 +- vmware_nsx/tests/unit/nsx_v/test_availability_zones.py | 4 ++-- .../tests/unit/services/flowclassifier/test_nsxv_driver.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/tests/unit/dvs/test_plugin.py b/vmware_nsx/tests/unit/dvs/test_plugin.py index 1d6d6d2081..7760a23e57 100644 --- a/vmware_nsx/tests/unit/dvs/test_plugin.py +++ b/vmware_nsx/tests/unit/dvs/test_plugin.py @@ -290,7 +290,7 @@ class NeutronSimpleDvsTest(test_plugin.NeutronDbPluginV2TestCase): self.assertEqual(True, updated_net['shared']) # Update the description attribute - self.assertEqual(None, network['description']) + self.assertIsNone(network['description']) updated_net = self._plugin.update_network( ctx, id, {'network': {'description': 'test'}}) diff --git a/vmware_nsx/tests/unit/nsx_v/test_availability_zones.py b/vmware_nsx/tests/unit/nsx_v/test_availability_zones.py index c418656886..c9d80b56f8 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_availability_zones.py +++ b/vmware_nsx/tests/unit/nsx_v/test_availability_zones.py @@ -37,7 +37,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase): self.assertEqual("respool", az.resource_pool) self.assertEqual("datastore", az.datastore_id) 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): az = nsx_az.ConfiguredAvailabilityZone( @@ -46,7 +46,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase): self.assertEqual("respool", az.resource_pool) self.assertEqual("datastore", az.datastore_id) 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): self.assertRaises( diff --git a/vmware_nsx/tests/unit/services/flowclassifier/test_nsxv_driver.py b/vmware_nsx/tests/unit/services/flowclassifier/test_nsxv_driver.py index d5e5dd6532..c775011415 100644 --- a/vmware_nsx/tests/unit/services/flowclassifier/test_nsxv_driver.py +++ b/vmware_nsx/tests/unit/services/flowclassifier/test_nsxv_driver.py @@ -294,4 +294,4 @@ class TestNsxvFlowClassifierDriver( self.assertTrue(mock_update_section.called) section = mock_update_section.call_args[0][0] # make sure the rule is not there - self.assertEqual(None, section.find('rule')) + self.assertIsNone(section.find('rule'))