summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_future.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-28 17:48:06 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-28 17:48:06 (GMT)
commit62e2c7e3dfffd8465a54b99fc6d3c2a60acab350 (patch)
treec65779760ccbdca9ec76deb901b94fd91e0908af /Lib/test/test_future.py
parentad3d3f2f3f19833f59fd7e9ec59e1714e0986e08 (diff)
downloadcpython-62e2c7e3dfffd8465a54b99fc6d3c2a60acab350.zip
cpython-62e2c7e3dfffd8465a54b99fc6d3c2a60acab350.tar.gz
cpython-62e2c7e3dfffd8465a54b99fc6d3c2a60acab350.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_future.py')
-rw-r--r--Lib/test/test_future.py45
1 files changed, 45 insertions, 0 deletions
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))
+