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
This commit is contained in:
Pavlo Shchelokovskyy 2013-12-25 16:21:12 +02:00
parent 97d945e879
commit a911f577da
1 changed files with 3 additions and 3 deletions

View File

@ -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):