Using assertIsNotNone() instead of assertIsNot(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, assertIsNotNone(...) is preferred over
and assertIsNot(None, ...).

Change-Id: I8a4de5d2786a44f68a951a3e06ce426fc19e1aff
This commit is contained in:
Luong Anh Tuan 2016-08-29 10:15:15 +07:00 committed by Tuan Luong-Anh
parent a5cc0be5c6
commit b6b31c2e41

View File

@ -377,10 +377,10 @@ class CreateInstanceTypeTest(test.TestCase):
def test_flavorid_populated(self):
flavor1 = flavors.create('flavor1', 64, 1, 120)
self.assertIsNot(None, flavor1.flavorid)
self.assertIsNotNone(flavor1.flavorid)
flavor2 = flavors.create('flavor2', 64, 1, 120, flavorid='')
self.assertIsNot(None, flavor2.flavorid)
self.assertIsNotNone(flavor2.flavorid)
flavor3 = flavors.create('flavor3', 64, 1, 120, flavorid='foo')
self.assertEqual('foo', flavor3.flavorid)
@ -388,7 +388,7 @@ class CreateInstanceTypeTest(test.TestCase):
def test_default_values(self):
flavor1 = flavors.create('flavor1', 64, 1, 120)
self.assertIsNot(None, flavor1.flavorid)
self.assertIsNotNone(flavor1.flavorid)
self.assertEqual(flavor1.ephemeral_gb, 0)
self.assertEqual(flavor1.swap, 0)
self.assertEqual(flavor1.rxtx_factor, 1.0)