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: Ie85f5ae13ebb3f6b320c8790da9d23427ed65ffb
This commit is contained in:
zhengwei6082 2017-11-09 14:40:18 +08:00
parent 27398c3573
commit 78c7d4c04e

View File

@ -359,7 +359,7 @@ class TestMemcached(unittest.TestCase):
with patch("sys.stdout", fake_stdout),\
patch('swift.common.memcached.logging', logger):
mock.read_return_empty_str = True
self.assertEqual(memcache_client.get('some_key'), None)
self.assertIsNone(memcache_client.get('some_key'))
log_lines = logger.get_lines_for_level('error')
self.assertIn('Error talking to memcached', log_lines[0])
self.assertFalse(log_lines[1:])