<s> import unittest <EOL> from test import test_support <EOL> import re <EOL> rx = re . compile ( '<STR_LIT>' ) <EOL> def get_error_location ( msg ) : <EOL> mo = rx . search ( str ( msg ) ) <EOL> return mo . group ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> class FutureTest ( unittest . TestCase ) : <EOL> def test_future1 ( self ) : <EOL> test_support . unload ( '<STR_LIT>' ) <EOL> from test import test_future1 <EOL> self . assertEqual ( test_future1 . result , <NUM_LIT:6> ) <EOL> def test_future2 ( self ) : <EOL> test_support . unload ( '<STR_LIT>' ) <EOL> from test import test_future2 <EOL> self . assertEqual ( test_future2 . result , <NUM_LIT:6> ) <EOL> def test_future3 ( self ) : <EOL> test_support . unload ( '<STR_LIT>' ) <EOL> from test import test_future3 <EOL> def test_badfuture3 ( self ) : <EOL> try : <EOL> from test import badsyntax_future3 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture4 ( self ) : <EOL> try : <EOL> from test import badsyntax_future4 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture5 ( self ) : <EOL> try : <EOL> from test import badsyntax_future5 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:4>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture6 ( self ) : <EOL> try : <EOL> from test import badsyntax_future6 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture7 ( self ) : <EOL> try : <EOL> from test import badsyntax_future7 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture8 ( self ) : <EOL> try : <EOL> from test import badsyntax_future8 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_badfuture9 ( self ) : <EOL> try : <EOL> from test import badsyntax_future9 <EOL> except SyntaxError , msg : <EOL> self . assertEqual ( get_error_location ( msg ) , ( "<STR_LIT>" , '<STR_LIT:3>' ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_parserhack ( self ) : <EOL> try : <EOL> exec "<STR_LIT>" <EOL> except SyntaxError : <EOL> pass <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> try : <EOL> exec "<STR_LIT>" <EOL> except SyntaxError : <EOL> pass <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_multiple_features ( self ) : <EOL> test_support . unload ( "<STR_LIT>" ) <EOL> from test import test_future5 <EOL> def test_unicode_literals_exec ( self ) : <EOL> scope = { } <EOL> exec "<STR_LIT>" in scope <EOL> self . assertIsInstance ( scope [ "<STR_LIT:x>" ] , unicode ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( FutureTest ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
