Browse Source

Replace assertEqual(None, *) with assertIsNone in tests

Apparently, this is a thing.

Change-Id: I878a6633924422fbf9f00657ce8282f32de8cb0f
Closes-Bug:#1280522
tags/5.0.0.0b1
Amrith Kumar 3 years ago
parent
commit
8b02a1eae3

+ 1
- 1
trove/tests/api/instances_resize.py View File

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

+ 8
- 8
trove/tests/unittests/api/common/test_limits.py View File

@@ -248,7 +248,7 @@ class LimitTest(BaseLimitTestSuite):
248 248
 
249 249
         limit._get_time = MagicMock(return_value=0.0)
250 250
         delay = limit("GET", "/anything")
251
-        self.assertEqual(None, delay)
251
+        self.assertIsNone(delay)
252 252
         self.assertEqual(0, limit.next_request)
253 253
         self.assertEqual(0, limit.last_request)
254 254
 
@@ -258,7 +258,7 @@ class LimitTest(BaseLimitTestSuite):
258 258
         limit._get_time = MagicMock(return_value=0.0)
259 259
 
260 260
         delay = limit("GET", "/anything")
261
-        self.assertEqual(None, delay)
261
+        self.assertIsNone(delay)
262 262
 
263 263
         delay = limit("GET", "/anything")
264 264
         self.assertEqual(1, delay)
@@ -268,7 +268,7 @@ class LimitTest(BaseLimitTestSuite):
268 268
         limit._get_time = MagicMock(return_value=4.0)
269 269
 
270 270
         delay = limit("GET", "/anything")
271
-        self.assertEqual(None, delay)
271
+        self.assertIsNone(delay)
272 272
         self.assertEqual(4, limit.next_request)
273 273
         self.assertEqual(4, limit.last_request)
274 274
 
@@ -528,25 +528,25 @@ class WsgiLimiterTest(BaseLimitTestSuite):
528 528
 
529 529
     def test_good_url(self):
530 530
         delay = self._request("GET", "/something")
531
-        self.assertEqual(None, delay)
531
+        self.assertIsNone(delay)
532 532
 
533 533
     def test_escaping(self):
534 534
         delay = self._request("GET", "/something/jump%20up")
535
-        self.assertEqual(None, delay)
535
+        self.assertIsNone(delay)
536 536
 
537 537
     def test_response_to_delays(self):
538 538
         delay = self._request("GET", "/delayed")
539
-        self.assertEqual(None, delay)
539
+        self.assertIsNone(delay)
540 540
 
541 541
         delay = self._request("GET", "/delayed")
542 542
         self.assertAlmostEqual(float(delay), 60, 1)
543 543
 
544 544
     def test_response_to_delays_usernames(self):
545 545
         delay = self._request("GET", "/delayed", "user1")
546
-        self.assertEqual(None, delay)
546
+        self.assertIsNone(delay)
547 547
 
548 548
         delay = self._request("GET", "/delayed", "user2")
549
-        self.assertEqual(None, delay)
549
+        self.assertIsNone(delay)
550 550
 
551 551
         delay = self._request("GET", "/delayed", "user1")
552 552
         self.assertAlmostEqual(float(delay), 60, 1)

+ 2
- 2
trove/tests/unittests/common/test_pagination.py View File

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

+ 1
- 1
trove/tests/unittests/common/test_utils.py View File

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

+ 1
- 1
trove/tests/unittests/guestagent/test_guestagent_utils.py View File

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

+ 1
- 1
trove/tests/unittests/guestagent/test_mongodb_manager.py View File

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

Loading…
Cancel
Save