From b55a286462052ef4e1b8e43f6ea1ac418de4b178 Mon Sep 17 00:00:00 2001 From: Cao Xuan Hoang Date: Tue, 15 Nov 2016 11:35:40 +0700 Subject: [PATCH] Using assertIsNotNone() instead of assertNotEqual(None) Following OpenStack Style Guidelines[1]: [H203] Unit test assertions tend to give better messages for more specific assertions. As a result, assertIsNotNone(...) is preferred over assertNotEqual(None, ...) and assertIsNot(None, ...) [1] http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises Change-Id: Iadb27153109b2c4b92df43fc97a5e50eed86f58c --- keystoneauth1/tests/unit/test_matchers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keystoneauth1/tests/unit/test_matchers.py b/keystoneauth1/tests/unit/test_matchers.py index 05d487cb..458aeabd 100644 --- a/keystoneauth1/tests/unit/test_matchers.py +++ b/keystoneauth1/tests/unit/test_matchers.py @@ -64,11 +64,11 @@ actual = matches = self.matches_matches mismatches = self.matches_mismatches for candidate in matches: - self.assertEqual(None, matcher.match(candidate)) + self.assertIsNone(matcher.match(candidate)) for candidate in mismatches: mismatch = matcher.match(candidate) - self.assertNotEqual(None, mismatch) - self.assertNotEqual(None, getattr(mismatch, 'describe', None)) + self.assertIsNotNone(mismatch) + self.assertIsNotNone(getattr(mismatch, 'describe', None)) def test__str__(self): # [(expected, object to __str__)].