blob: 12813d4b446df6cd027b671f7f49447b2dd7ad6a [file] [log] [blame]
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +00001# Test various flavors of legal and illegal future statements
2
Barry Warsaw04f357c2002-07-23 19:04:11 +00003from test.test_support import unload
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +00004import re
5
6rx = re.compile('\((\S+).py, line (\d+)')
7
8def check_error_location(msg):
9 mo = rx.search(msg)
10 print "SyntaxError %s %s" % mo.group(1, 2)
11
12# The first two tests should work
13
14unload('test_future1')
Barry Warsaw408b6d32002-07-30 23:27:12 +000015from test import test_future1
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000016
17unload('test_future2')
Barry Warsaw408b6d32002-07-30 23:27:12 +000018from test import test_future2
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000019
Jeremy Hylton8471a352001-08-20 20:33:42 +000020unload('test_future3')
Barry Warsaw408b6d32002-07-30 23:27:12 +000021from test import test_future3
Jeremy Hylton8471a352001-08-20 20:33:42 +000022
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000023# The remaining tests should fail
24try:
Barry Warsaw408b6d32002-07-30 23:27:12 +000025 from test import badsyntax_future3
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000026except SyntaxError, msg:
27 check_error_location(str(msg))
28
29try:
Barry Warsaw408b6d32002-07-30 23:27:12 +000030 from test import badsyntax_future4
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000031except SyntaxError, msg:
32 check_error_location(str(msg))
33
34try:
Barry Warsaw408b6d32002-07-30 23:27:12 +000035 from test import badsyntax_future5
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000036except SyntaxError, msg:
37 check_error_location(str(msg))
38
39try:
Barry Warsaw408b6d32002-07-30 23:27:12 +000040 from test import badsyntax_future6
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000041except SyntaxError, msg:
42 check_error_location(str(msg))
43
44try:
Barry Warsaw408b6d32002-07-30 23:27:12 +000045 from test import badsyntax_future7
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000046except SyntaxError, msg:
47 check_error_location(str(msg))