Browse Source

Replace assertEqual(None, *) with assertIsNone in tests

Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: I7ea0306009e8fdde468c1394615972de4d296f45
Closes-Bug:#1280522
tags/1.4.0
Yusuke Hayashi 3 years ago
parent
commit
780a1299cb

+ 2
- 2
cinderclient/tests/unit/test_shell.py View File

@@ -113,14 +113,14 @@ class ShellTest(utils.TestCase):
113 113
         v2_url, v3_url = _shell._discover_auth_versions(
114 114
             None, auth_url=os_auth_url)
115 115
         self.assertEqual(v2_url, os_auth_url, "Expected v2 url")
116
-        self.assertEqual(v3_url, None, "Expected no v3 url")
116
+        self.assertIsNone(v3_url, "Expected no v3 url")
117 117
 
118 118
         os_auth_url = "https://DiscoveryNotSupported.discovery.com:35357/v3.0"
119 119
         self.register_keystone_auth_fixture(mocker, os_auth_url)
120 120
         v2_url, v3_url = _shell._discover_auth_versions(
121 121
             None, auth_url=os_auth_url)
122 122
         self.assertEqual(v3_url, os_auth_url, "Expected v3 url")
123
-        self.assertEqual(v2_url, None, "Expected no v2 url")
123
+        self.assertIsNone(v2_url, "Expected no v2 url")
124 124
 
125 125
     @mock.patch('sys.stdin', side_effect=mock.MagicMock)
126 126
     @mock.patch('getpass.getpass', return_value='password')

+ 1
- 1
cinderclient/tests/unit/v2/test_consistencygroups.py View File

@@ -89,7 +89,7 @@ class ConsistencygroupsTest(utils.TestCase):
89 89
         cs.assert_called('PUT', '/consistencygroups/1234', body=expected)
90 90
 
91 91
     def test_update_consistencygroup_none(self):
92
-        self.assertEqual(None, cs.consistencygroups.update('1234'))
92
+        self.assertIsNone(cs.consistencygroups.update('1234'))
93 93
 
94 94
     def test_update_consistencygroup_no_props(self):
95 95
         cs.consistencygroups.update('1234')

+ 1
- 1
cinderclient/tests/unit/v2/test_volumes.py View File

@@ -235,7 +235,7 @@ class FormatSortParamTestCase(utils.TestCase):
235 235
 
236 236
     def test_format_sort_empty_input(self):
237 237
         for s in [None, '', []]:
238
-            self.assertEqual(None, cs.volumes._format_sort_param(s))
238
+            self.assertIsNone(cs.volumes._format_sort_param(s))
239 239
 
240 240
     def test_format_sort_string_single_key(self):
241 241
         s = 'id'

Loading…
Cancel
Save