f5462e204d637c73541232226f89145c6f329871
# Test various flavors of legal and illegal future statements
from test
import test_support
rx
= re
.compile('\((\S+).py, line (\d+)')
def get_error_location(msg
):
class FutureTest(unittest
.TestCase
):
test_support
.unload('test_future1')
from test
import test_future1
self
.assertEqual(test_future1
.result
, 6)
test_support
.unload('test_future2')
from test
import test_future2
self
.assertEqual(test_future2
.result
, 6)
test_support
.unload('test_future3')
from test
import test_future3
def test_badfuture3(self
):
from test
import badsyntax_future3
self
.assertEqual(get_error_location(msg
), ("badsyntax_future3", '3'))
self
.fail("expected exception didn't occur")
def test_badfuture4(self
):
from test
import badsyntax_future4
self
.assertEqual(get_error_location(msg
), ("badsyntax_future4", '3'))
self
.fail("expected exception didn't occur")
def test_badfuture5(self
):
from test
import badsyntax_future5
self
.assertEqual(get_error_location(msg
), ("badsyntax_future5", '4'))
self
.fail("expected exception didn't occur")
def test_badfuture6(self
):
from test
import badsyntax_future6
self
.assertEqual(get_error_location(msg
), ("badsyntax_future6", '3'))
self
.fail("expected exception didn't occur")
def test_badfuture7(self
):
from test
import badsyntax_future7
self
.assertEqual(get_error_location(msg
), ("badsyntax_future7", '3'))
self
.fail("expected exception didn't occur")
def test_badfuture8(self
):
from test
import badsyntax_future8
self
.assertEqual(get_error_location(msg
), ("badsyntax_future8", '3'))
self
.fail("expected exception didn't occur")
def test_badfuture9(self
):
from test
import badsyntax_future9
self
.assertEqual(get_error_location(msg
), ("badsyntax_future9", '3'))
self
.fail("expected exception didn't occur")
test_support
.run_unittest(FutureTest
)
if __name__
== "__main__":