1 # Test various flavors of legal and illegal future statements
3 from test
.test_support
import unload
6 rx
= re
.compile('\((\S+).py, line (\d+)')
8 def check_error_location(msg
):
10 print "SyntaxError %s %s" % mo
.group(1, 2)
12 # The first two tests should work
14 unload('test_future1')
15 from test
import test_future1
17 unload('test_future2')
18 from test
import test_future2
20 unload('test_future3')
21 from test
import test_future3
23 # The remaining tests should fail
25 from test
import badsyntax_future3
26 except SyntaxError, msg
:
27 check_error_location(str(msg
))
30 from test
import badsyntax_future4
31 except SyntaxError, msg
:
32 check_error_location(str(msg
))
35 from test
import badsyntax_future5
36 except SyntaxError, msg
:
37 check_error_location(str(msg
))
40 from test
import badsyntax_future6
41 except SyntaxError, msg
:
42 check_error_location(str(msg
))
45 from test
import badsyntax_future7
46 except SyntaxError, msg
:
47 check_error_location(str(msg
))