Using assertIsNone() instead of assertEqual(None, ...)

Following OpenStack Style Guidelines[1]:
[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, ...)

[1] http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises

Change-Id: Ie8136f1be4a57272e64b0b360ee608aa270901f7
This commit is contained in:
Cao Xuan Hoang 2016-11-15 16:51:56 +07:00
parent 0af7db23fe
commit db648ad781
1 changed files with 2 additions and 2 deletions

View File

@ -159,7 +159,7 @@ class DirectoryLoaderTest(base.TestCase):
with mock.patch('muranopkgcheck.pkg_loader.os.path.isdir') as m_isdir:
m_isdir.return_value = False
pkg = pkg_loader.DirectoryLoader.try_load('fake')
self.assertEqual(None, pkg)
self.assertIsNone(pkg)
def test_list_files(self):
# NOTE(sslypushenko) Using mock.patch here as decorator breaks pdb
@ -209,7 +209,7 @@ class ZipLoaderTest(base.TestCase):
with mock.patch('muranopkgcheck.pkg_loader.zipfile.ZipFile') as m_zip:
m_zip.side_effect = zipfile.BadZipfile
pkg = pkg_loader.ZipLoader.try_load('fake')
self.assertEqual(None, pkg)
self.assertIsNone(pkg)
@mock.patch.object(pkg_loader.ZipLoader, 'read')
@mock.patch.object(pkg_loader.ZipLoader, 'try_set_format')