Merge "Add check for deprecated method assertEquals"

This commit is contained in:
Jenkins 2013-08-15 19:44:15 +00:00 committed by Gerrit Code Review
commit 1bcf93164a
2 changed files with 17 additions and 0 deletions

View File

@ -639,6 +639,22 @@ def hacking_no_cr(physical_line):
return (pos, "H601: Windows style line endings not allowed in code")
@flake8ext
def hacking_no_assert_equals(logical_line, tokens):
r"""assertEquals() is deprecated, use assertEqual instead.
Okay: self.assertEqual(0, 0)
H602: self.assertEquals(0, 0)
"""
for token_type, text, start_index, _, _ in tokens:
if token_type == tokenize.NAME and text == "assertEquals":
yield (
start_index[1],
"H602: assertEquals is deprecated, use assertEqual")
FORMAT_RE = re.compile("%(?:"
"%|" # Ignore plain percents
"(\(\w+\))?" # mapping key

View File

@ -39,6 +39,7 @@ flake8.extension =
H404 = hacking.core:hacking_docstring_multiline_start
H501 = hacking.core:hacking_no_locals
H601 = hacking.core:hacking_no_cr
H602 = hacking.core:hacking_no_assert_equals
H700 = hacking.core:hacking_localization_strings
H801 = hacking.core:OnceGitCheckCommitTitleBug
H802 = hacking.core:OnceGitCheckCommitTitleLength