diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-11-18 00:17:08 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-11-18 00:17:08 +0200 |
commit | a49eecc16f967505b7890a2724e1ea8d00c6772a (patch) | |
tree | f17a561bfae96df8d5fcfd204bb67647e9058b92 | |
parent | 9489d1110f716b1145c2a1b317a918ee94311a49 (diff) | |
download | pylint-a49eecc16f967505b7890a2724e1ea8d00c6772a.tar.gz |
Fix more false positives for old-octal-literal.
-rw-r--r-- | checkers/python3.py | 2 | ||||
-rw-r--r-- | test/unittest_checker_python3.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/checkers/python3.py b/checkers/python3.py index da8f6c4..ec8f4b7 100644 --- a/checkers/python3.py +++ b/checkers/python3.py @@ -26,7 +26,7 @@ from pylint.checkers import utils _OLD_OCTAL = re.compile("0\d{1}") def _is_old_octal(literal): - return _OLD_OCTAL.match(literal) + return _OLD_OCTAL.match(literal) and set(literal) != set(['0']) def _check_dict_node(node): inferred = node.infer() diff --git a/test/unittest_checker_python3.py b/test/unittest_checker_python3.py index 4f9e2ab..9aa2d1f 100644 --- a/test/unittest_checker_python3.py +++ b/test/unittest_checker_python3.py @@ -285,10 +285,11 @@ class Python3TokenCheckerTest(testutils.CheckerTestCase): def test_old_octal_literal(self): self._test_token_message("045", "old-octal-literal") - # Make sure we are catching only octals. - tokens = testutils.tokenize_str("45") - with self.assertNoMessages(): - self.checker.process_tokens(tokens) + # Make sure we are catching only octals. + for non_octal in ("45", "00"): + tokens = testutils.tokenize_str(non_octal) + with self.assertNoMessages(): + self.checker.process_tokens(tokens) if __name__ == '__main__': |