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: I74452af6d840bcf612fd3bb2521db9134460dd63
Closes-Bug: #1280522
tags/2.4.0
weiweigu 2 years ago
parent
commit
38c58123ca

+ 2
- 2
taskflow/tests/unit/test_failure.py View File

@@ -64,7 +64,7 @@ class GeneralFailureObjTestsMixin(object):
64 64
 
65 65
     def test_check_str_not_there(self):
66 66
         val = 'ValueError'
67
-        self.assertEqual(None, self.fail_obj.check(val))
67
+        self.assertIsNone(self.fail_obj.check(val))
68 68
 
69 69
     def test_check_type(self):
70 70
         self.assertIs(self.fail_obj.check(RuntimeError), RuntimeError)
@@ -306,7 +306,7 @@ class WrappedFailureTestCase(test.TestCase):
306 306
         fail_obj = _captured_failure('Woot!')
307 307
         wf = exceptions.WrappedFailure([fail_obj])
308 308
         self.assertEqual(RuntimeError, wf.check(RuntimeError))
309
-        self.assertEqual(None, wf.check(ValueError))
309
+        self.assertIsNone(wf.check(ValueError))
310 310
 
311 311
     def test_two_failures(self):
312 312
         fls = [

+ 3
- 3
taskflow/tests/unit/test_storage.py View File

@@ -179,7 +179,7 @@ class StorageTestMixin(object):
179 179
     def test_reset_unknown_task(self):
180 180
         s = self._get_storage()
181 181
         s.ensure_atom(test_utils.NoopTask('my task'))
182
-        self.assertEqual(None, s.reset('my task'))
182
+        self.assertIsNone(s.reset('my task'))
183 183
 
184 184
     def test_fetch_by_name(self):
185 185
         s = self._get_storage()
@@ -215,7 +215,7 @@ class StorageTestMixin(object):
215 215
         s = self._get_storage()
216 216
         s.ensure_atom(test_utils.NoopTask('my task'))
217 217
         self.assertEqual(0.0, s.get_task_progress('my task'))
218
-        self.assertEqual(None, s.get_task_progress_details('my task'))
218
+        self.assertIsNone(s.get_task_progress_details('my task'))
219 219
 
220 220
     def test_task_progress(self):
221 221
         s = self._get_storage()
@@ -248,7 +248,7 @@ class StorageTestMixin(object):
248 248
 
249 249
         s.set_task_progress('my task', 0.8, {})
250 250
         self.assertEqual(0.8, s.get_task_progress('my task'))
251
-        self.assertEqual(None, s.get_task_progress_details('my task'))
251
+        self.assertIsNone(s.get_task_progress_details('my task'))
252 252
 
253 253
     def test_fetch_result_not_ready(self):
254 254
         s = self._get_storage()

+ 2
- 2
taskflow/tests/unit/test_utils.py View File

@@ -103,7 +103,7 @@ class CachedPropertyTest(test.TestCase):
103 103
             def b(self):
104 104
                 return 'b'
105 105
 
106
-        self.assertEqual(None, inspect.getdoc(A.b))
106
+        self.assertIsNone(inspect.getdoc(A.b))
107 107
 
108 108
     def test_threaded_access_property(self):
109 109
         called = collections.deque()
@@ -172,7 +172,7 @@ class UriParseTest(test.TestCase):
172 172
         url = "rsync://test@www.yahoo.com:873"
173 173
         parsed = misc.parse_uri(url)
174 174
         self.assertEqual('test', parsed.username)
175
-        self.assertEqual(None, parsed.password)
175
+        self.assertIsNone(parsed.password)
176 176
 
177 177
 
178 178
 class TestSequenceMinus(test.TestCase):

+ 1
- 1
taskflow/tests/unit/worker_based/test_endpoint.py View File

@@ -80,4 +80,4 @@ class TestEndpoint(test.TestCase):
80 80
                                      progress_callback=None,
81 81
                                      result=self.task_result,
82 82
                                      failures={})
83
-        self.assertEqual(None, result)
83
+        self.assertIsNone(result)

Loading…
Cancel
Save