summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2014-05-29 19:14:06 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2014-05-29 19:14:06 +0200
commit2d072332abb69ba024329ea333954998be280221 (patch)
treed4667815ad44d320a7b31f30e5bbae84a2caf864 /testsuite
parent164066c4d85f212f5f4a11699b848942c678b947 (diff)
parentd6d2f0b2ec50ffce2d1ad469fbd4e2b1642cfa0f (diff)
downloadpep8-2d072332abb69ba024329ea333954998be280221.tar.gz
Report E731 for lambda assignment, return E704 for one-liner def instead of E701; issue #277
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/E22.py4
-rw-r--r--testsuite/E70.py19
-rw-r--r--testsuite/E73.py7
3 files changed, 22 insertions, 8 deletions
diff --git a/testsuite/E22.py b/testsuite/E22.py
index 43a6f3f..56af307 100644
--- a/testsuite/E22.py
+++ b/testsuite/E22.py
@@ -135,8 +135,8 @@ baz(**kwargs)
negative = -1
spam(-1)
-negative
-lambda *args, **kw: (args, kw)
-lambda a, b=h[:], c=0: (a, b, c)
+func1(lambda *args, **kw: (args, kw))
+func2(lambda a, b=h[:], c=0: (a, b, c))
if not -5 < x < +5:
print >>sys.stderr, "x is out of range."
print >> sys.stdout, "x is an integer."
diff --git a/testsuite/E70.py b/testsuite/E70.py
index 64feefd..85ca666 100644
--- a/testsuite/E70.py
+++ b/testsuite/E70.py
@@ -1,13 +1,20 @@
-#: E701
+#: E701:1:5
if a: a = False
-#: E701
+#: E701:1:40
if not header or header[:6] != 'bytes=': return
-#: E702
+#: E702:1:10
a = False; b = True
-#: E702
+#: E702:1:17
import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe)
-#: E703
+#: E703:1:13
import shlex;
-#: E702 E703
+#: E702:1:9 E703:1:23
del a[:]; a.append(42);
+#: E704:1:1
+def f(x): return 2
+#: E704:1:1 E226:1:19
+def f(x): return 2*x
+#: E704:2:5 E226:2:23
+while all is round:
+ def f(x): return 2*x
#:
diff --git a/testsuite/E73.py b/testsuite/E73.py
new file mode 100644
index 0000000..0673e0f
--- /dev/null
+++ b/testsuite/E73.py
@@ -0,0 +1,7 @@
+#: E731:1:1
+f = lambda x: 2 * x
+#: E731:1:1 E226:1:16
+f = lambda x: 2*x
+#: E731:2:5
+while False:
+ this = lambda y, z: 2 * x