blob: ba0763b7c7106addde83b525c81a1beb741127b8 [file] [log] [blame]
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +00001# Test various flavors of legal and illegal future statements
2
3from test_support import unload
4import 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')
15import test_future1
16
17unload('test_future2')
18import test_future2
19
20# The remaining tests should fail
21try:
Jeremy Hylton30906942001-04-18 01:19:28 +000022 import badsyntax_future3
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000023except SyntaxError, msg:
24 check_error_location(str(msg))
25
26try:
Jeremy Hylton30906942001-04-18 01:19:28 +000027 import badsyntax_future4
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000028except SyntaxError, msg:
29 check_error_location(str(msg))
30
31try:
Jeremy Hylton30906942001-04-18 01:19:28 +000032 import badsyntax_future5
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000033except SyntaxError, msg:
34 check_error_location(str(msg))
35
36try:
Jeremy Hylton30906942001-04-18 01:19:28 +000037 import badsyntax_future6
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000038except SyntaxError, msg:
39 check_error_location(str(msg))
40
41try:
Jeremy Hylton30906942001-04-18 01:19:28 +000042 import badsyntax_future7
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000043except SyntaxError, msg:
44 check_error_location(str(msg))