Using assertIsNone() instead of assertIs(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: I72327e4c740ef11ee9cba4cda9642e4a270d1b52
This commit is contained in:
Ji-Wei 2016-09-22 21:12:32 +08:00 committed by mark mcclain
parent 59e25b504d
commit e3b3947af8
2 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class TestuNeutronModels(base.RugTestBase):
}
s = neutron.Subnet.from_dict(d)
self.assertEqual(netaddr.IPNetwork('fe80::/64'), s.cidr)
self.assertIs(None, s.gateway_ip)
self.assertIsNone(s.gateway_ip)
def test_subnet_gateway_not_ip(self):
d = {
@ -175,7 +175,7 @@ class TestuNeutronModels(base.RugTestBase):
}
s = neutron.Subnet.from_dict(d)
self.assertEqual(netaddr.IPNetwork('fe80::/64'), s.cidr)
self.assertIs(None, s.gateway_ip)
self.assertIsNone(s.gateway_ip)
def test_subnet_cidr_none(self):
d = {

View File

@ -233,7 +233,7 @@ class TestGetCRUD(base.RugTestBase):
def test_notification_astara(self):
e = self._get_event_notification('astara.bandwidth.used')
self.assertIs(None, e)
self.assertIsNone(e)
def test_notification_cmd_poll(self):
event_type = 'astara.command'