From c960500ecd25a89a4286034f7d0e71353f85ac1e Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Fri, 6 Sep 2013 12:01:26 +0800 Subject: [PATCH] Utilizes assertIsNotNone Using assertTrue and the 'is not' operator to test if an element is not None is too python2.4. Our unit testing framework supports assertIsNotNone, included from python 2.7, which was created for these types of tests. Change-Id: I25c3f2b144357a3f86625deb8e324d78c20b9ce4 --- cinder/tests/scheduler/test_filter_scheduler.py | 2 +- cinder/tests/test_hp3par.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinder/tests/scheduler/test_filter_scheduler.py b/cinder/tests/scheduler/test_filter_scheduler.py index e9f673ce8..f5a7a4d0e 100644 --- a/cinder/tests/scheduler/test_filter_scheduler.py +++ b/cinder/tests/scheduler/test_filter_scheduler.py @@ -94,7 +94,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): 'size': 1}} self.mox.ReplayAll() weighed_host = sched._schedule(fake_context, request_spec, {}) - self.assertTrue(weighed_host.obj is not None) + self.assertIsNotNone(weighed_host.obj) def test_max_attempts(self): self.flags(scheduler_max_attempts=4) diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index 011c47172..ed568b2fd 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -566,7 +566,7 @@ class HP3PARBaseDriver(): 'source_volid': HP3PARBaseDriver.VOLUME_ID} src_vref = {} model_update = self.driver.create_cloned_volume(volume, src_vref) - self.assertTrue(model_update is not None) + self.assertIsNotNone(model_update) def test_create_snapshot(self): self.flags(lock_path=self.tempdir) -- 2.45.2