summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorNikhil Benesch <nikhil.benesch@gmail.com>2015-05-19 20:40:33 -0400
committerIan Lee <IanLee1521@gmail.com>2016-06-25 14:13:50 -0700
commit6b75c4de380c5e786d277851a7da8a581da53bcb (patch)
tree9af2652c530f6a77dd5dc35d53ec08d6c20c25bd /testsuite
parentdc08dadd84369185f3c19782fd727dbf5029a056 (diff)
downloadpep8-6b75c4de380c5e786d277851a7da8a581da53bcb.tar.gz
Fix issue #400: Require two blank lines after toplevel def, class
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/E12not.py3
-rw-r--r--testsuite/E22.py1
-rw-r--r--testsuite/E30.py29
-rw-r--r--testsuite/support.py1
-rw-r--r--testsuite/test_all.py1
5 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/E12not.py b/testsuite/E12not.py
index e76ef13..18c6a64 100644
--- a/testsuite/E12not.py
+++ b/testsuite/E12not.py
@@ -139,6 +139,7 @@ def long_function_name(
var_four):
print(var_one)
+
if ((row < 0 or self.moduleCount <= row or
col < 0 or self.moduleCount <= col)):
raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
@@ -400,6 +401,7 @@ def unicode2html(s):
.replace('"', '&#34;')
.replace('\n', '<br>\n'))
+
#
parser.add_option('--count', action='store_true',
help="print total number of errors and warnings "
@@ -616,6 +618,7 @@ def other_example():
for key, val in node.items()
))]
+
foo([
'bug'
])
diff --git a/testsuite/E22.py b/testsuite/E22.py
index 9d8efda..ee9dc74 100644
--- a/testsuite/E22.py
+++ b/testsuite/E22.py
@@ -150,6 +150,7 @@ if alpha[:-i]:
def squares(n):
return (i**2 for i in range(n))
+
ENG_PREFIXES = {
-6: "\u03bc", # Greek letter mu
-3: "m",
diff --git a/testsuite/E30.py b/testsuite/E30.py
index d2d7bf3..1aa1137 100644
--- a/testsuite/E30.py
+++ b/testsuite/E30.py
@@ -88,3 +88,32 @@ def function():
It gives error E303: too many blank lines (3)
"""
#:
+
+#: E305:7:1
+def a():
+ print
+
+ # comment
+
+ # another comment
+a()
+#: E305:8:1
+def a():
+ print
+
+ # comment
+
+ # another comment
+
+try:
+ a()
+except:
+ pass
+#: E305:5:1
+def a():
+ print
+
+# Two spaces before comments, too.
+if a():
+ a()
+#:
diff --git a/testsuite/support.py b/testsuite/support.py
index 003f181..cf9abc5 100644
--- a/testsuite/support.py
+++ b/testsuite/support.py
@@ -196,5 +196,6 @@ def run_tests(style):
init_tests(style)
return style.check_files()
+
# nose should not collect these functions
init_tests.__test__ = run_tests.__test__ = False
diff --git a/testsuite/test_all.py b/testsuite/test_all.py
index bd18943..08f9ea9 100644
--- a/testsuite/test_all.py
+++ b/testsuite/test_all.py
@@ -62,5 +62,6 @@ def suite():
def _main():
return unittest.TextTestRunner(verbosity=2).run(suite())
+
if __name__ == '__main__':
sys.exit(not _main())