<s> import unittest <EOL> from test import test_support <EOL> import __future__ <EOL> GOOD_SERIALS = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> features = __future__ . all_feature_names <EOL> class FutureTest ( unittest . TestCase ) : <EOL> def test_names ( self ) : <EOL> given_feature_names = features [ : ] <EOL> for name in dir ( __future__ ) : <EOL> obj = getattr ( __future__ , name , None ) <EOL> if obj is not None and isinstance ( obj , __future__ . _Feature ) : <EOL> self . assertTrue ( <EOL> name in given_feature_names , <EOL> "<STR_LIT>" % name <EOL> ) <EOL> given_feature_names . remove ( name ) <EOL> self . assertEqual ( len ( given_feature_names ) , <NUM_LIT:0> , <EOL> "<STR_LIT>" % given_feature_names ) <EOL> def test_attributes ( self ) : <EOL> for feature in features : <EOL> value = getattr ( __future__ , feature ) <EOL> optional = value . getOptionalRelease ( ) <EOL> mandatory = value . getMandatoryRelease ( ) <EOL> a = self . assertTrue <EOL> e = self . assertEqual <EOL> def check ( t , name ) : <EOL> a ( isinstance ( t , tuple ) , "<STR_LIT>" % name ) <EOL> e ( len ( t ) , <NUM_LIT:5> , "<STR_LIT>" % name ) <EOL> ( major , minor , micro , level , serial ) = t <EOL> a ( isinstance ( major , int ) , "<STR_LIT>" % name ) <EOL> a ( isinstance ( minor , int ) , "<STR_LIT>" % name ) <EOL> a ( isinstance ( micro , int ) , "<STR_LIT>" % name ) <EOL> a ( isinstance ( level , basestring ) , <EOL> "<STR_LIT>" % name ) <EOL> a ( level in GOOD_SERIALS , <EOL> "<STR_LIT>" % name ) <EOL> a ( isinstance ( serial , int ) , "<STR_LIT>" % name ) <EOL> check ( optional , "<STR_LIT>" ) <EOL> if mandatory is not None : <EOL> check ( mandatory , "<STR_LIT>" ) <EOL> a ( optional < mandatory , <EOL> "<STR_LIT>" ) <EOL> a ( hasattr ( value , "<STR_LIT>" ) , <EOL> "<STR_LIT>" ) <EOL> compile ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , value . compiler_flag ) <EOL> a ( isinstance ( getattr ( value , "<STR_LIT>" ) , int ) , <EOL> "<STR_LIT>" ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( FutureTest ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
