diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-11-17 21:28:55 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-11-17 21:28:55 +0200 |
commit | 9489d1110f716b1145c2a1b317a918ee94311a49 (patch) | |
tree | bc8a277646c3f6688e3e6da324fa3762cbcc3dfd | |
parent | 2c1906932be3d598a54108fd125011cce66081f5 (diff) | |
download | pylint-9489d1110f716b1145c2a1b317a918ee94311a49.tar.gz |
Fix the flawed check of old octal syntax.
-rw-r--r-- | checkers/python3.py | 2 | ||||
-rw-r--r-- | test/unittest_checker_python3.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/checkers/python3.py b/checkers/python3.py index 1da2933..da8f6c4 100644 --- a/checkers/python3.py +++ b/checkers/python3.py @@ -23,7 +23,7 @@ from pylint.utils import WarningScope from pylint.checkers import utils -_OLD_OCTAL = re.compile("\d{2}") +_OLD_OCTAL = re.compile("0\d{1}") def _is_old_octal(literal): return _OLD_OCTAL.match(literal) diff --git a/test/unittest_checker_python3.py b/test/unittest_checker_python3.py index f7eead9..4f9e2ab 100644 --- a/test/unittest_checker_python3.py +++ b/test/unittest_checker_python3.py @@ -285,6 +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) + if __name__ == '__main__': unittest.main() |