Replace assertTrue(a in b) with assertIn(a, b)

Since python2.6 is no more supported, replacing
assertTrue(a in b) with assertIn(a, b) can be done.
This will give better message during the test failure
as a bonus.

Change-Id: I14b1801dd710eaf6d8433a6193eeaacd5d1c5a90
This commit is contained in:
Pradeep Kumar Singh 2015-07-29 09:43:26 +09:00
parent 65694bc2f0
commit 53f4eb62ae

View File

@ -598,7 +598,7 @@ class DictObjectMixinTest(oslotest.base.BaseTestCase):
def test_contains(self): def test_contains(self):
obj = TestObjectDict(name=1) obj = TestObjectDict(name=1)
self.assertTrue('name' in obj) self.assertIn('name', obj)
def test_get(self): def test_get(self):
obj = TestObjectDict(name=1) obj = TestObjectDict(name=1)
@ -799,9 +799,9 @@ class ListObjectMixinTest(oslotest.base.BaseTestCase):
# Create a ListObject # Create a ListObject
obj = TestObjectList(objects=[obj_one, obj_two]) obj = TestObjectList(objects=[obj_one, obj_two])
self.assertTrue(obj_one in obj) self.assertIn(obj_one, obj)
self.assertTrue(obj_two in obj) self.assertIn(obj_two, obj)
self.assertFalse(obj_three in obj) self.assertNotIn(obj_three, obj)
def test_extend(self): def test_extend(self):
# Create a few objects # Create a few objects