From 53f4eb62ae338cc17758f05a6ca0af28d3d08d0b Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Singh Date: Wed, 29 Jul 2015 09:43:26 +0900 Subject: [PATCH] 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 --- designate/tests/unit/test_objects/test_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designate/tests/unit/test_objects/test_base.py b/designate/tests/unit/test_objects/test_base.py index e3c29c7f..2ab81808 100644 --- a/designate/tests/unit/test_objects/test_base.py +++ b/designate/tests/unit/test_objects/test_base.py @@ -598,7 +598,7 @@ class DictObjectMixinTest(oslotest.base.BaseTestCase): def test_contains(self): obj = TestObjectDict(name=1) - self.assertTrue('name' in obj) + self.assertIn('name', obj) def test_get(self): obj = TestObjectDict(name=1) @@ -799,9 +799,9 @@ class ListObjectMixinTest(oslotest.base.BaseTestCase): # Create a ListObject obj = TestObjectList(objects=[obj_one, obj_two]) - self.assertTrue(obj_one in obj) - self.assertTrue(obj_two in obj) - self.assertFalse(obj_three in obj) + self.assertIn(obj_one, obj) + self.assertIn(obj_two, obj) + self.assertNotIn(obj_three, obj) def test_extend(self): # Create a few objects