Merge "Handle Py35 fix of ast.node.col_offset bug"

This commit is contained in:
Jenkins 2016-07-20 16:14:12 +00:00 committed by Gerrit Code Review
commit 0d7eb58930
2 changed files with 12 additions and 3 deletions

View File

@ -16,6 +16,8 @@
# test_hacking_checks test cases.
# flake8: noqa
import sys
import fixtures
@ -73,11 +75,18 @@ class HackingCode(fixtures.Fixture):
(25, 14, 'K001'),
(25, 36, 'K001'),
(28, 10, 'K001'),
(28, 27, 'K001'),
(28, 26, 'K001'),
(29, 21, 'K001'),
(32, 11, 'K001'),
(32, 10, 'K001'),
]}
# NOTE(browne): This is gross, but in Python 3.4 and earlier, the ast
# module returns the incorrect col_offset for two of the defined functions
# in the code sample above.
if sys.version_info < (3, 5):
mutable_default_args['expected_errors'][12] = (28, 27, 'K001')
mutable_default_args['expected_errors'][14] = (32, 11, 'K001')
comments_begin_with_space = {
'code': """
# This is a good comment

View File

@ -50,7 +50,7 @@ class BaseStyleCheck(unit.BaseTestCase):
def assert_has_errors(self, code, expected_errors=None):
actual_errors = [e[:3] for e in self.run_check(code)]
self.assertEqual(expected_errors or [], actual_errors)
self.assertItemsEqual(expected_errors or [], actual_errors)
class TestCheckForMutableDefaultArgs(BaseStyleCheck):