From 62e2c7e3dfffd8465a54b99fc6d3c2a60acab350 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 28 Feb 2001 17:48:06 +0000 Subject: Add regression test for future statements. This adds eight files, but seven are not tests in their own right; these files are mentioned in regrtest. --- Lib/test/output/test_future | 8 ++++++++ Lib/test/regrtest.py | 7 +++++++ Lib/test/test_future.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ Lib/test/test_future1.py | 9 +++++++++ Lib/test/test_future2.py | 10 ++++++++++ Lib/test/test_future3.py | 10 ++++++++++ Lib/test/test_future4.py | 10 ++++++++++ Lib/test/test_future5.py | 12 ++++++++++++ Lib/test/test_future6.py | 10 ++++++++++ Lib/test/test_future7.py | 11 +++++++++++ 10 files changed, 132 insertions(+) create mode 100644 Lib/test/output/test_future create mode 100644 Lib/test/test_future.py create mode 100644 Lib/test/test_future1.py create mode 100644 Lib/test/test_future2.py create mode 100644 Lib/test/test_future3.py create mode 100644 Lib/test/test_future4.py create mode 100644 Lib/test/test_future5.py create mode 100644 Lib/test/test_future6.py create mode 100644 Lib/test/test_future7.py diff --git a/Lib/test/output/test_future b/Lib/test/output/test_future new file mode 100644 index 0000000..5d7770a --- /dev/null +++ b/Lib/test/output/test_future @@ -0,0 +1,8 @@ +test_future +6 +6 +SyntaxError test_future3 3 +SyntaxError test_future4 3 +SyntaxError test_future5 4 +SyntaxError test_future6 3 +SyntaxError test_future7 3 diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 43e630e..f05f764 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -197,6 +197,13 @@ NOTTESTS = [ 'test_support', 'test_b1', 'test_b2', + 'test_future1', + 'test_future2', + 'test_future3', + 'test_future4', + 'test_future5', + 'test_future6', + 'test_future7', ] def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py new file mode 100644 index 0000000..36a1346 --- /dev/null +++ b/Lib/test/test_future.py @@ -0,0 +1,45 @@ +# Test various flavors of legal and illegal future statements + +from test_support import unload +import re + +rx = re.compile('\((\S+).py, line (\d+)') + +def check_error_location(msg): + mo = rx.search(msg) + print "SyntaxError %s %s" % mo.group(1, 2) + +# The first two tests should work + +unload('test_future1') +import test_future1 + +unload('test_future2') +import test_future2 + +# The remaining tests should fail +try: + import test_future3 +except SyntaxError, msg: + check_error_location(str(msg)) + +try: + import test_future4 +except SyntaxError, msg: + check_error_location(str(msg)) + +try: + import test_future5 +except SyntaxError, msg: + check_error_location(str(msg)) + +try: + import test_future6 +except SyntaxError, msg: + check_error_location(str(msg)) + +try: + import test_future7 +except SyntaxError, msg: + check_error_location(str(msg)) + diff --git a/Lib/test/test_future1.py b/Lib/test/test_future1.py new file mode 100644 index 0000000..0589661 --- /dev/null +++ b/Lib/test/test_future1.py @@ -0,0 +1,9 @@ +"""This is a test""" +from __future__ import nested_scopes + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future2.py b/Lib/test/test_future2.py new file mode 100644 index 0000000..e3df0a6 --- /dev/null +++ b/Lib/test/test_future2.py @@ -0,0 +1,10 @@ +"""This is a test""" + +from __future__ import nested_scopes; import string + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future3.py b/Lib/test/test_future3.py new file mode 100644 index 0000000..166628c --- /dev/null +++ b/Lib/test/test_future3.py @@ -0,0 +1,10 @@ +"""This is a test""" +from __future__ import nested_scopes +from __future__ import rested_snopes + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future4.py b/Lib/test/test_future4.py new file mode 100644 index 0000000..805263b --- /dev/null +++ b/Lib/test/test_future4.py @@ -0,0 +1,10 @@ +"""This is a test""" +import __future__ +from __future__ import nested_scopes + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future5.py b/Lib/test/test_future5.py new file mode 100644 index 0000000..1186208 --- /dev/null +++ b/Lib/test/test_future5.py @@ -0,0 +1,12 @@ +"""This is a test""" +from __future__ import nested_scopes +import foo +from __future__ import nested_scopes + + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future6.py b/Lib/test/test_future6.py new file mode 100644 index 0000000..35c1455 --- /dev/null +++ b/Lib/test/test_future6.py @@ -0,0 +1,10 @@ +"""This is a test""" +"this isn't a doc string" +from __future__ import nested_scopes + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) diff --git a/Lib/test/test_future7.py b/Lib/test/test_future7.py new file mode 100644 index 0000000..370372d --- /dev/null +++ b/Lib/test/test_future7.py @@ -0,0 +1,11 @@ +"""This is a test""" + +from __future__ import nested_scopes; import string; from __future__ import \ + nested_scopes + +def f(x): + def g(y): + return x + y + return g + +print f(2)(4) -- cgit v0.12