summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-04-26 00:52:19 +0200
committerTorsten Marek <shlomme@gmail.com>2014-04-26 00:52:19 +0200
commit751762c8ed3858e3be0a256e1197aaf9d4328664 (patch)
tree7d60a351b4e794e2c29f96a76a953ee14ed13a6b
parentf68668644c79777e1ea55effa63b6022c81c839b (diff)
downloadpylint-751762c8ed3858e3be0a256e1197aaf9d4328664.tar.gz
Make the test suite pass on Python 2.6 again.
-rw-r--r--checkers/format.py2
-rw-r--r--test/input/func_bad_cont_dictcomp_py27.py38
-rw-r--r--test/input/func_bad_continuation.py35
-rw-r--r--test/messages/func_bad_cont_dictcomp_py27.txt6
-rw-r--r--test/messages/func_bad_continuation.txt30
-rw-r--r--test/messages/func_format_py_27.txt4
-rw-r--r--test/unittest_checker_typecheck.py6
7 files changed, 62 insertions, 59 deletions
diff --git a/checkers/format.py b/checkers/format.py
index c02986e..eedce59 100644
--- a/checkers/format.py
+++ b/checkers/format.py
@@ -229,7 +229,7 @@ _CONTINUATION_MSG_PARTS = {
def _Offsets(*args):
"""Valid indentation offsets for a continued line."""
- return {a: None for a in args}
+ return dict((a, None) for a in args)
def _BeforeBlockOffsets(single, with_body):
diff --git a/test/input/func_bad_cont_dictcomp_py27.py b/test/input/func_bad_cont_dictcomp_py27.py
new file mode 100644
index 0000000..a552710
--- /dev/null
+++ b/test/input/func_bad_cont_dictcomp_py27.py
@@ -0,0 +1,38 @@
+"""Bad continuations in dictionary comprehensions."""
+
+__revision__ = 0
+
+# Dictionary comprehensions should not require extra indentation when breaking
+# before the 'for', which is not part of the value
+C1 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)}
+
+C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
+ range(3)}
+
+# Dictionary comprehensions with multiple loops broken in different places
+C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
+
+C4 = {x*y: (x, y)
+ for x in range(3) for y in range(3)}
+
+C5 = {x*y: (x, y) for x
+ in range(3) for y in range(3)}
+
+C6 = {x*y: (x, y) for x in range(3)
+ for y in range(3)}
+
+C7 = {key:
+ key ** 2
+ for key in range(10)}
+
+C8 = {
+ key: key ** 2
+ for key in range(10)}
+
+# Misaligned cases for dict comprehensions
+C9 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)} # [bad-continuation]
+
+C9 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)} # [bad-continuation]
diff --git a/test/input/func_bad_continuation.py b/test/input/func_bad_continuation.py
index 351a03a..03beaf4 100644
--- a/test/input/func_bad_continuation.py
+++ b/test/input/func_bad_continuation.py
@@ -89,41 +89,6 @@ W9 = {'key1':
'value1', # [bad-continuation]
}
-# Dictionary comprehensions should not require extra indentation when breaking
-# before the 'for', which is not part of the value
-C1 = {'key{}'.format(x): 'value{}'.format(x)
- for x in range(3)}
-
-C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
- range(3)}
-
-# Dictionary comprehensions with multiple loops broken in different places
-C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
-
-C4 = {x*y: (x, y)
- for x in range(3) for y in range(3)}
-
-C5 = {x*y: (x, y) for x
- in range(3) for y in range(3)}
-
-C6 = {x*y: (x, y) for x in range(3)
- for y in range(3)}
-
-C7 = {key:
- key ** 2
- for key in range(10)}
-
-C8 = {
- key: key ** 2
- for key in range(10)}
-
-# Misaligned cases for dict comprehensions
-C9 = {'key{}'.format(x): 'value{}'.format(x)
- for x in range(3)} # [bad-continuation]
-
-C9 = {'key{}'.format(x): 'value{}'.format(x)
- for x in range(3)} # [bad-continuation]
-
# Alignment of arguments in function definitions
def continue1(some_arg,
some_other_arg):
diff --git a/test/messages/func_bad_cont_dictcomp_py27.txt b/test/messages/func_bad_cont_dictcomp_py27.txt
new file mode 100644
index 0000000..7443d55
--- /dev/null
+++ b/test/messages/func_bad_cont_dictcomp_py27.txt
@@ -0,0 +1,6 @@
+C: 35: Wrong continued indentation.
+ for x in range(3)} # [bad-continuation]
+ ^ |
+C: 38: Wrong continued indentation.
+ for x in range(3)} # [bad-continuation]
+ | ^
diff --git a/test/messages/func_bad_continuation.txt b/test/messages/func_bad_continuation.txt
index ba6516d..42087e5 100644
--- a/test/messages/func_bad_continuation.txt
+++ b/test/messages/func_bad_continuation.txt
@@ -28,43 +28,37 @@ C: 85: Wrong hanging indentation in dict value.
C: 89: Wrong hanging indentation in dict value.
'value1', # [bad-continuation]
^ | |
-C:122: Wrong continued indentation.
- for x in range(3)} # [bad-continuation]
- ^ |
-C:125: Wrong continued indentation.
- for x in range(3)} # [bad-continuation]
- | ^
-C:141: Wrong hanging indentation before block.
+C:106: Wrong hanging indentation before block.
some_arg, # [bad-continuation]
^ |
-C:142: Wrong hanging indentation before block.
+C:107: Wrong hanging indentation before block.
some_other_arg): # [bad-continuation]
^ |
-C:146:continue4: Missing function docstring
-C:162: Wrong continued indentation.
+C:111:continue4: Missing function docstring
+C:127: Wrong continued indentation.
"b") # [bad-continuation]
^ |
-C:176: Wrong hanging indentation before block.
+C:141: Wrong hanging indentation before block.
): pass # [bad-continuation]
| ^|
-C:179: Wrong continued indentation before block.
+C:144: Wrong continued indentation before block.
2): # [bad-continuation]
^ |
-C:187: Wrong continued indentation.
+C:152: Wrong continued indentation.
2 and # [bad-continuation]
| ^
-C:192: Wrong hanging indentation before block.
+C:157: Wrong hanging indentation before block.
2): pass # [bad-continuation]
^ | |
-C:199: Wrong continued indentation before block.
+C:164: Wrong continued indentation before block.
2 or # [bad-continuation]
|^ |
-C:203: Wrong continued indentation before block.
+C:168: Wrong continued indentation before block.
2): pass # [bad-continuation]
^ | |
-C:209: Wrong hanging indentation before block.
+C:174: Wrong hanging indentation before block.
2): # [bad-continuation]
^ | |
-C:220: Wrong continued indentation.
+C:185: Wrong continued indentation.
2): # [bad-continuation]
^ |
diff --git a/test/messages/func_format_py_27.txt b/test/messages/func_format_py_27.txt
index 20cba32..ae114eb 100644
--- a/test/messages/func_format_py_27.txt
+++ b/test/messages/func_format_py_27.txt
@@ -41,5 +41,5 @@ C: 71: Exactly one space required before assignment
C: 73: Exactly one space required around assignment
ocount[obj.__class__]=1
^
-C:100: More than one statement on a single line
-C:103: More than one statement on a single line
+C: 99: More than one statement on a single line
+C:102: More than one statement on a single line
diff --git a/test/unittest_checker_typecheck.py b/test/unittest_checker_typecheck.py
index 352b6f9..0a8687b 100644
--- a/test/unittest_checker_typecheck.py
+++ b/test/unittest_checker_typecheck.py
@@ -13,14 +13,14 @@ class TypeCheckerTest(CheckerTestCase):
"""
node = test_utils.extract_node("""
- import argparse
- argparse.THIS_does_not_EXIST
+ import optparse
+ optparse.THIS_does_not_EXIST
""")
with self.assertAddsMessages(
Message(
'no-member',
node=node,
- args=('Module', 'argparse', 'THIS_does_not_EXIST'))):
+ args=('Module', 'optparse', 'THIS_does_not_EXIST'))):
self.checker.visit_getattr(node)
@set_config(ignored_modules=('argparse',))