Replace assertEqual(None, *) with assertIsNone in tests

Apparently, this is a thing.

Change-Id: I878a6633924422fbf9f00657ce8282f32de8cb0f
Closes-Bug:#1280522
changes/55/236655/2
Amrith Kumar 7 years ago
parent eac486f7eb
commit 8b02a1eae3
  1. 2
      trove/tests/api/instances_resize.py
  2. 16
      trove/tests/unittests/api/common/test_limits.py
  3. 4
      trove/tests/unittests/common/test_pagination.py
  4. 2
      trove/tests/unittests/common/test_utils.py
  5. 2
      trove/tests/unittests/guestagent/test_guestagent_utils.py
  6. 2
      trove/tests/unittests/guestagent/test_mongodb_manager.py

@ -247,7 +247,7 @@ class MigrateTests(ResizeTestBase):
def _execute_action(self):
self.instance.update_db(task_status=InstanceTasks.NONE)
self.mock.ReplayAll()
self.assertEqual(None, self.action.execute())
self.assertIsNone(self.action.execute())
self.mock.VerifyAll()
def _start_mysql(self):

@ -248,7 +248,7 @@ class LimitTest(BaseLimitTestSuite):
limit._get_time = MagicMock(return_value=0.0)
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
self.assertEqual(0, limit.next_request)
self.assertEqual(0, limit.last_request)
@ -258,7 +258,7 @@ class LimitTest(BaseLimitTestSuite):
limit._get_time = MagicMock(return_value=0.0)
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
delay = limit("GET", "/anything")
self.assertEqual(1, delay)
@ -268,7 +268,7 @@ class LimitTest(BaseLimitTestSuite):
limit._get_time = MagicMock(return_value=4.0)
delay = limit("GET", "/anything")
self.assertEqual(None, delay)
self.assertIsNone(delay)
self.assertEqual(4, limit.next_request)
self.assertEqual(4, limit.last_request)
@ -528,25 +528,25 @@ class WsgiLimiterTest(BaseLimitTestSuite):
def test_good_url(self):
delay = self._request("GET", "/something")
self.assertEqual(None, delay)
self.assertIsNone(delay)
def test_escaping(self):
delay = self._request("GET", "/something/jump%20up")
self.assertEqual(None, delay)
self.assertIsNone(delay)
def test_response_to_delays(self):
delay = self._request("GET", "/delayed")
self.assertEqual(None, delay)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed")
self.assertAlmostEqual(float(delay), 60, 1)
def test_response_to_delays_usernames(self):
delay = self._request("GET", "/delayed", "user1")
self.assertEqual(None, delay)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed", "user2")
self.assertEqual(None, delay)
self.assertIsNone(delay)
delay = self._request("GET", "/delayed", "user1")
self.assertAlmostEqual(float(delay), 60, 1)

@ -52,7 +52,7 @@ class TestPaginatedDataView(trove_testtools.TestCase):
# continue list, do not include marker in result
li_2, marker_2 = self._do_paginate_list(limit=2, marker=marker_1)
self.assertEqual(['d', 'e'], li_2)
self.assertEqual(None, marker_2)
self.assertIsNone(marker_2)
# alternate continue list, include marker in result
li_3, marker_3 = self._do_paginate_list(limit=2, marker=marker_1,
@ -63,4 +63,4 @@ class TestPaginatedDataView(trove_testtools.TestCase):
# bad marker
li_4, marker_4 = self._do_paginate_list(marker='f')
self.assertEqual([], li_4)
self.assertEqual(None, marker_4)
self.assertIsNone(marker_4)

@ -68,7 +68,7 @@ class TestTroveExecuteWithTimeout(trove_testtools.TestCase):
self.assertEqual('test', utils.unpack_singleton('test'))
self.assertEqual('test', utils.unpack_singleton(['test']))
self.assertEqual([], utils.unpack_singleton([]))
self.assertEqual(None, utils.unpack_singleton(None))
self.assertIsNone(utils.unpack_singleton(None))
self.assertEqual([None, None], utils.unpack_singleton([None, None]))
self.assertEqual('test', utils.unpack_singleton([['test']]))
self.assertEqual([1, 2, 3], utils.unpack_singleton([[1, 2, 3]]))

@ -144,4 +144,4 @@ class TestGuestagentUtils(trove_testtools.TestCase):
self.assertEqual(1024, guestagent_utils.to_bytes(1024))
self.assertEqual('Hello!', guestagent_utils.to_bytes('Hello!'))
self.assertEqual('', guestagent_utils.to_bytes(''))
self.assertEqual(None, guestagent_utils.to_bytes(None))
self.assertIsNone(guestagent_utils.to_bytes(None))

@ -237,7 +237,7 @@ class GuestAgentMongoDBManagerTest(trove_testtools.TestCase):
users, next_marker = self.manager.list_users(self.context)
self.assertEqual(None, next_marker)
self.assertIsNone(next_marker)
self.assertEqual(sorted([user1, user2]), users)
@mock.patch.object(service.MongoDBAdmin, 'create_user')

Loading…
Cancel
Save