diff --git a/hacking/core.py b/hacking/core.py index fe712385..1db7f4b6 100755 --- a/hacking/core.py +++ b/hacking/core.py @@ -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 diff --git a/setup.cfg b/setup.cfg index 00da5051..7fa6974c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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