Using assertIsNone() instead of assertEqual(None)
Following OpenStack Style Guidelines[1]: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises [H203] Unit test assertions tend to give better messages for more specific assertions. As a result, assertIsNone(...) is preferred over assertEqual(None, ...) and assertIs(..,None) Change-Id: I8881abed6e7962d1516323725e194937bce1346f
This commit is contained in:
parent
25be3fa02c
commit
7a204383d5
@ -159,7 +159,7 @@ class RequestTest(MicroversionedTest):
|
||||
request = wsgi.Request.blank('/')
|
||||
accepted = 'nb-no'
|
||||
request.headers = {'Accept-Language': accepted}
|
||||
self.assertIs(request.best_match_language(), None)
|
||||
self.assertIsNone(request.best_match_language())
|
||||
|
||||
def test_no_lang_header(self):
|
||||
self.stubs.Set(i18n, 'get_available_languages',
|
||||
@ -168,7 +168,7 @@ class RequestTest(MicroversionedTest):
|
||||
request = wsgi.Request.blank('/')
|
||||
accepted = ''
|
||||
request.headers = {'Accept-Language': accepted}
|
||||
self.assertIs(request.best_match_language(), None)
|
||||
self.assertIsNone(request.best_match_language())
|
||||
|
||||
def test_api_version_request_header_none(self):
|
||||
request = wsgi.Request.blank('/')
|
||||
|
@ -233,7 +233,7 @@ class _TestFloatingIPObject(object):
|
||||
ips = [objects.FloatingIPList.make_ip_info('1.1.1.1', 'pool', 'eth0'),
|
||||
objects.FloatingIPList.make_ip_info('1.1.1.2', 'loop', 'eth1')]
|
||||
result = objects.FloatingIPList.create(None, ips)
|
||||
self.assertIs(result, None)
|
||||
self.assertIsNone(result)
|
||||
result = objects.FloatingIPList.create(None, ips, want_result=True)
|
||||
self.assertEqual('1.1.1.1', str(result[0].address))
|
||||
self.assertEqual('1.1.1.2', str(result[1].address))
|
||||
|
Loading…
Reference in New Issue
Block a user