From a911f577daf1b6f9d76f8a4334ee5a471acc06e6 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Wed, 25 Dec 2013 16:21:12 +0200 Subject: [PATCH] Fix comparison with singletons Many places in tests code use assertEqual(AA, None), the same with True and False and negatives of such comparisons. As comparison to singletons must use `is` operator, appropriate usage is assertIs, assertIsNot, assertIsNone, assertIsNotNone These assertions are provided by the `testtools` package, so this change is not breaking backward compatibility with Python 2.6 Change-Id: I232136ce49afdb8bf78b42221454540471d12c23 Closes-Bug: #1259023 --- heatclient/tests/test_common_http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heatclient/tests/test_common_http.py b/heatclient/tests/test_common_http.py index 9a8a1574..e3d86ba5 100644 --- a/heatclient/tests/test_common_http.py +++ b/heatclient/tests/test_common_http.py @@ -259,7 +259,7 @@ class HttpClientTest(testtools.TestCase): client = http.HTTPClient('http://example.com:8004') resp, body = client.json_request('GET', '', body='test-body') self.assertEqual(resp.status, 200) - self.assertEqual(body, None) + self.assertIsNone(body) self.m.VerifyAll() def test_http_json_request_invalid_json(self): @@ -355,7 +355,7 @@ class HttpClientTest(testtools.TestCase): self.fail('No exception raised') except exc.HTTPNotFound as e: # Assert that the raised exception can be converted to string - self.assertNotEqual(e.message, None) + self.assertIsNotNone(e.message) self.m.VerifyAll() def test_http_300_json_request(self): @@ -378,7 +378,7 @@ class HttpClientTest(testtools.TestCase): self.fail('No exception raised') except exc.HTTPMultipleChoices as e: # Assert that the raised exception can be converted to string - self.assertNotEqual(e.message, None) + self.assertIsNotNone(e.message) self.m.VerifyAll() #def test_https_json_request(self):