Merge "Add assertNotEquals check to H602"
This commit is contained in:
commit
cd31f92ba7
@ -673,18 +673,20 @@ def hacking_no_cr(physical_line):
|
|||||||
|
|
||||||
@flake8ext
|
@flake8ext
|
||||||
def hacking_no_assert_equals(logical_line, tokens):
|
def hacking_no_assert_equals(logical_line, tokens):
|
||||||
r"""assertEquals() is deprecated, use assertEqual instead.
|
r"""assert(Not)Equals() is deprecated, use assert(Not)Equal instead.
|
||||||
|
|
||||||
Okay: self.assertEqual(0, 0)
|
Okay: self.assertEqual(0, 0)
|
||||||
|
Okay: self.assertNotEqual(0, 1)
|
||||||
H602: self.assertEquals(0, 0)
|
H602: self.assertEquals(0, 0)
|
||||||
|
H602: self.assertNotEquals(0, 1)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for token_type, text, start_index, _, _ in tokens:
|
for token_type, text, start_index, _, _ in tokens:
|
||||||
|
|
||||||
if token_type == tokenize.NAME and text == "assertEquals":
|
if token_type == tokenize.NAME:
|
||||||
yield (
|
if text == "assertEquals" or text == "assertNotEquals":
|
||||||
start_index[1],
|
yield (start_index[1],
|
||||||
"H602: assertEquals is deprecated, use assertEqual")
|
"H602: %s is deprecated, use %s" % (text, text[:-1]))
|
||||||
|
|
||||||
|
|
||||||
@flake8ext
|
@flake8ext
|
||||||
|
Loading…
x
Reference in New Issue
Block a user