Using assertIsNone() instead of assertEqual(None, ...)
Following OpenStack Style Guidelines[1]: [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, ...) [1] http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises Change-Id: I14f54cbb7dce27e70fed4ef1cb85748474f54fc5
This commit is contained in:
@@ -60,7 +60,7 @@ class ToscaDefTest(TestCase):
|
||||
|
||||
def test_group(self):
|
||||
self.assertEqual(group_type.type, "tosca.groups.Root")
|
||||
self.assertEqual(group_type.parent_type, None)
|
||||
self.assertIsNone(group_type.parent_type)
|
||||
self.assertIn(ifaces.LIFECYCLE_SHORTNAME, group_type.interfaces)
|
||||
|
||||
def test_capabilities(self):
|
||||
@@ -185,12 +185,12 @@ class ToscaDefTest(TestCase):
|
||||
relation, node in network_port_type.relationship.items()])
|
||||
|
||||
def test_interfaces(self):
|
||||
self.assertEqual(compute_type.interfaces, None)
|
||||
self.assertIsNone(compute_type.interfaces)
|
||||
root_node = NodeType('tosca.nodes.Root')
|
||||
self.assertIn(ifaces.LIFECYCLE_SHORTNAME, root_node.interfaces)
|
||||
|
||||
def test_artifacts(self):
|
||||
self.assertEqual(artif_root_type.parent_type, None)
|
||||
self.assertIsNone(artif_root_type.parent_type)
|
||||
self.assertEqual('tosca.artifacts.Root',
|
||||
artif_file_type.parent_type.type)
|
||||
self.assertEqual({}, artif_file_type.parent_artifacts)
|
||||
@@ -285,7 +285,7 @@ class ToscaDefTest(TestCase):
|
||||
key=lambda x: str(x)))
|
||||
|
||||
def test_policies(self):
|
||||
self.assertEqual(policy_root_type.parent_type, None)
|
||||
self.assertIsNone(policy_root_type.parent_type)
|
||||
self.assertEqual('tosca.policies.Root',
|
||||
policy_placement_type.parent_type.type)
|
||||
self.assertEqual({}, policy_placement_type.parent_policies)
|
||||
|
||||
Reference in New Issue
Block a user