Use assertIn(A, B) instead of assertTrue(A in B )

Developers should use assertIn(A, B) instead of assertTrue(A in B ).

TrivialFix

Change-Id: I0d7c542272315590536c427a8865e49660361e55
This commit is contained in:
Bin Zhou 2016-09-02 12:05:58 +08:00
parent 45d3e67b98
commit 1626b63f56
2 changed files with 8 additions and 8 deletions

View File

@ -106,8 +106,8 @@ class TestModuleList(utils.TestCommand):
columns, data = self.cmd.take_action(parsed_args)
# Additional modules may be present, just check our additions
self.assertTrue(module_name_1 in columns)
self.assertTrue(module_version_1 in data)
self.assertIn(module_name_1, columns)
self.assertIn(module_version_1, data)
def test_module_list_all(self):
arglist = [
@ -124,7 +124,7 @@ class TestModuleList(utils.TestCommand):
columns, data = self.cmd.take_action(parsed_args)
# Additional modules may be present, just check our additions
self.assertTrue(module_name_1 in columns)
self.assertTrue(module_name_2 in columns)
self.assertTrue(module_version_1 in data)
self.assertTrue(module_version_2 in data)
self.assertIn(module_name_1, columns)
self.assertIn(module_name_2, columns)
self.assertIn(module_version_1, data)
self.assertIn(module_version_2, data)

View File

@ -1128,7 +1128,7 @@ class TestImageSet(TestImage):
# ImageManager.update(image, **kwargs)
a, k = self.images_mock.update.call_args
self.assertEqual(image_fakes.image_id, a[0])
self.assertTrue('tags' in k)
self.assertIn('tags', k)
self.assertEqual(set(kwargs['tags']), set(k['tags']))
self.assertIsNone(result)
@ -1154,7 +1154,7 @@ class TestImageSet(TestImage):
# ImageManager.update(image, **kwargs)
a, k = self.images_mock.update.call_args
self.assertEqual(image_fakes.image_id, a[0])
self.assertTrue('tags' in k)
self.assertIn('tags', k)
self.assertEqual(set(kwargs['tags']), set(k['tags']))
self.assertIsNone(result)