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 | 056803c3a93ea3050a05fd243494fc2f87fedc3e (patch) | |
tree | db846b0709f30e9e79f63f3525a73f5412f4a5c7 | |
parent | fd9acc81a549e352243fbdf55eee270f98b07dfa (diff) | |
download | pylint-git-056803c3a93ea3050a05fd243494fc2f87fedc3e.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 da8f6c470..ec8f4b774 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 4f9e2ab82..9aa2d1f41 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__': |