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, ...) and assertIs(..,None)

Change-Id: I2ab46cc724665ed5362cee865c8c0dfa0e93a0ae
This commit is contained in:
Nam Nguyen Hoai 2016-09-27 11:42:14 +07:00
parent a4ff057f43
commit f9ffa14765
2 changed files with 4 additions and 4 deletions

View File

@ -127,7 +127,7 @@ class TestOVSFlowsForPortSecurity(test_base.DFTestBase):
# for knowing which flow didn't be installed when the test
# case failed, asserting expected_flow equals to None to print
# expected_flow
self.assertEqual(expected_flow, None)
self.assertIsNone(expected_flow)
def _check_not_flow_existed(self, flow_list):
ovs = utils.OvsFlowsParser()
@ -139,7 +139,7 @@ class TestOVSFlowsForPortSecurity(test_base.DFTestBase):
# for knowing which flow didn't be removed when the
# test case failed, asserting expected_flow equals to
# None to print expected_flow
self.assertEqual(expected_flow, None)
self.assertIsNone(expected_flow)
def test_default_flows(self):
expected_flow_list = []

View File

@ -248,11 +248,11 @@ class TestPubSub(test_base.DFTestBase):
publisher.send_event(update, other_topic)
eventlet.sleep(1)
self.assertEqual(self.events_action_t, None)
self.assertIsNone(self.events_action_t)
self.assertNotEqual(local_events_num + 2, self.events_num_t)
subscriber.unregister_topic(topic)
publisher.send_event(update, topic)
self.assertEqual(self.events_action_t, None)
self.assertIsNone(self.events_action_t)
subscriber.stop()
def test_pub_sub_register_addr(self):