Use assertIs(Not)None to check for None
[H203] Use assertIs(Not)None to check for None (off by default) Unit test assertions tend to give better messages for more specific assertions. As a result, assertIsNone(...) is preferred over assertEqual(None, ...) and assertIs(None, ...), and assertIsNotNone(...) is preferred over assertNotEqual(None, ...) and assertIsNot(None, ...). Off by default. More information, see: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises Change-Id: I73a9ed3e145b8f36c110725d148baf1fb0aef957
This commit is contained in:
parent
1c82f7ebbe
commit
3dcbdafdf9
@ -25,11 +25,11 @@ class TestMatchersInterface(object):
|
|||||||
matches = self.matches_matches
|
matches = self.matches_matches
|
||||||
mismatches = self.matches_mismatches
|
mismatches = self.matches_mismatches
|
||||||
for candidate in matches:
|
for candidate in matches:
|
||||||
self.assertEqual(None, matcher.match(candidate))
|
self.assertIsNone(matcher.match(candidate))
|
||||||
for candidate in mismatches:
|
for candidate in mismatches:
|
||||||
mismatch = matcher.match(candidate)
|
mismatch = matcher.match(candidate)
|
||||||
self.assertNotEqual(None, mismatch)
|
self.assertIsNotNone(mismatch)
|
||||||
self.assertNotEqual(None, getattr(mismatch, 'describe', None))
|
self.assertIsNotNone(getattr(mismatch, 'describe', None))
|
||||||
|
|
||||||
def test__str__(self):
|
def test__str__(self):
|
||||||
# [(expected, object to __str__)].
|
# [(expected, object to __str__)].
|
||||||
|
Loading…
Reference in New Issue
Block a user