From 31ed2a2be780e201eab7cde65d14dd7d80eeeab1 Mon Sep 17 00:00:00 2001 From: melissaml Date: Tue, 11 Oct 2016 13:12:54 +0800 Subject: [PATCH] Change assertTrue(isinstance()) by optimal assert Some of tests use different method of assertTrue(isinstance(A, B)) or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B) provided by testtools Change-Id: I8f721e98928c72847b720a64dc7020eb0ffe94fe --- oslo_utils/tests/test_importutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oslo_utils/tests/test_importutils.py b/oslo_utils/tests/test_importutils.py index dde97fb0..0fde3805 100644 --- a/oslo_utils/tests/test_importutils.py +++ b/oslo_utils/tests/test_importutils.py @@ -109,11 +109,11 @@ class ImportUtilsTest(test_base.BaseTestCase): def test_import_object(self): dt = importutils.import_object('datetime.time') - self.assertTrue(isinstance(dt, sys.modules['datetime'].time)) + self.assertIsInstance(dt, sys.modules['datetime'].time) def test_import_object_with_args(self): dt = importutils.import_object('datetime.datetime', 2012, 4, 5) - self.assertTrue(isinstance(dt, sys.modules['datetime'].datetime)) + self.assertIsInstance(dt, sys.modules['datetime'].datetime) self.assertEqual(dt, datetime.datetime(2012, 4, 5)) def test_try_import(self):