<s> """<STR_LIT>""" <EOL> import math <EOL> import sys <EOL> import unittest <EOL> from test import test_support <EOL> jython = test_support . is_jython <EOL> class FloatTestCase ( unittest . TestCase ) : <EOL> def test_float_repr ( self ) : <EOL> self . assertEqual ( repr ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( math . pi ** - <NUM_LIT:100> ) , <EOL> jython and '<STR_LIT>' or '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( - <NUM_LIT:1.0> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( - <NUM_LIT> ) , <EOL> jython and '<STR_LIT>' or '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> def test_float_str ( self ) : <EOL> self . assertEqual ( str ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( <NUM_LIT> ) , <EOL> jython and '<STR_LIT>' or '<STR_LIT>' ) <EOL> self . assertEqual ( str ( <NUM_LIT> ) , <EOL> jython and '<STR_LIT>' or '<STR_LIT>' ) <EOL> self . assertEqual ( str ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( math . pi ** - <NUM_LIT:100> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( <NUM_LIT:0.0> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( - <NUM_LIT:1.0> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( - <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( <NUM_LIT> ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( - <NUM_LIT> ) , '<STR_LIT>' ) <EOL> def test_float_str_formatting ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , <EOL> jython and '<STR_LIT>' or '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % math . pi ** - <NUM_LIT:100> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT:100> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % - <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT> , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' % <NUM_LIT:100> , '<STR_LIT>' ) <EOL> def test_overflow ( self ) : <EOL> shuge = '<STR_LIT>' * <NUM_LIT> <EOL> shuge_float = float ( shuge ) <EOL> shuge_int = int ( shuge ) <EOL> self . assertRaises ( OverflowError , float , shuge_int ) <EOL> self . assertRaises ( OverflowError , int , shuge_float ) <EOL> self . assertNotEqual ( <NUM_LIT:0.1> , shuge_int ) <EOL> def test_nan ( self ) : <EOL> nan = float ( '<STR_LIT>' ) <EOL> self . assert_ ( type ( nan ) , float ) <EOL> if jython : <EOL> self . assert_ ( type ( float ( '<STR_LIT>' ) ) , float ) <EOL> self . assertNotEqual ( nan , float ( '<STR_LIT>' ) ) <EOL> self . assertNotEqual ( nan , nan ) <EOL> self . assertEqual ( cmp ( nan , float ( '<STR_LIT>' ) ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( cmp ( nan , nan ) , <NUM_LIT:0> ) <EOL> for i in ( - <NUM_LIT:1> , <NUM_LIT:1> , - <NUM_LIT:1.0> , <NUM_LIT:1.0> ) : <EOL> self . assertEqual ( cmp ( nan , i ) , - <NUM_LIT:1> ) <EOL> self . assertEqual ( cmp ( i , nan ) , <NUM_LIT:1> ) <EOL> def test_infinity ( self ) : <EOL> self . assert_ ( type ( float ( '<STR_LIT>' ) ) , float ) <EOL> self . assert_ ( type ( float ( '<STR_LIT>' ) ) , float ) <EOL> self . assertRaises ( OverflowError , long , float ( '<STR_LIT>' ) ) <EOL> def test_float_none ( self ) : <EOL> self . assertRaises ( TypeError , float , None ) <EOL> def test_pow ( self ) : <EOL> class Foo ( object ) : <EOL> def __rpow__ ( self , other ) : <EOL> return other ** <NUM_LIT:2> <EOL> self . assertEqual ( <NUM_LIT> ** Foo ( ) , <NUM_LIT> ) <EOL> def test_faux ( self ) : <EOL> class F ( object ) : <EOL> def __float__ ( self ) : <EOL> return <NUM_LIT> <EOL> self . assertEqual ( math . cos ( <NUM_LIT> ) , math . cos ( F ( ) ) ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( FloatTestCase ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_main ( ) </s>
