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
changes/45/340645/1
weiweigu 6 years ago
parent 613181f571
commit 38c58123ca
  1. 4
      taskflow/tests/unit/test_failure.py
  2. 6
      taskflow/tests/unit/test_storage.py
  3. 4
      taskflow/tests/unit/test_utils.py
  4. 2
      taskflow/tests/unit/worker_based/test_endpoint.py

@ -64,7 +64,7 @@ class GeneralFailureObjTestsMixin(object):
def test_check_str_not_there(self):
val = 'ValueError'
self.assertEqual(None, self.fail_obj.check(val))
self.assertIsNone(self.fail_obj.check(val))
def test_check_type(self):
self.assertIs(self.fail_obj.check(RuntimeError), RuntimeError)
@ -306,7 +306,7 @@ class WrappedFailureTestCase(test.TestCase):
fail_obj = _captured_failure('Woot!')
wf = exceptions.WrappedFailure([fail_obj])
self.assertEqual(RuntimeError, wf.check(RuntimeError))
self.assertEqual(None, wf.check(ValueError))
self.assertIsNone(wf.check(ValueError))
def test_two_failures(self):
fls = [

@ -179,7 +179,7 @@ class StorageTestMixin(object):
def test_reset_unknown_task(self):
s = self._get_storage()
s.ensure_atom(test_utils.NoopTask('my task'))
self.assertEqual(None, s.reset('my task'))
self.assertIsNone(s.reset('my task'))
def test_fetch_by_name(self):
s = self._get_storage()
@ -215,7 +215,7 @@ class StorageTestMixin(object):
s = self._get_storage()
s.ensure_atom(test_utils.NoopTask('my task'))
self.assertEqual(0.0, s.get_task_progress('my task'))
self.assertEqual(None, s.get_task_progress_details('my task'))
self.assertIsNone(s.get_task_progress_details('my task'))
def test_task_progress(self):
s = self._get_storage()
@ -248,7 +248,7 @@ class StorageTestMixin(object):
s.set_task_progress('my task', 0.8, {})
self.assertEqual(0.8, s.get_task_progress('my task'))
self.assertEqual(None, s.get_task_progress_details('my task'))
self.assertIsNone(s.get_task_progress_details('my task'))
def test_fetch_result_not_ready(self):
s = self._get_storage()

@ -103,7 +103,7 @@ class CachedPropertyTest(test.TestCase):
def b(self):
return 'b'
self.assertEqual(None, inspect.getdoc(A.b))
self.assertIsNone(inspect.getdoc(A.b))
def test_threaded_access_property(self):
called = collections.deque()
@ -172,7 +172,7 @@ class UriParseTest(test.TestCase):
url = "rsync://test@www.yahoo.com:873"
parsed = misc.parse_uri(url)
self.assertEqual('test', parsed.username)
self.assertEqual(None, parsed.password)
self.assertIsNone(parsed.password)
class TestSequenceMinus(test.TestCase):

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

Loading…
Cancel
Save