def test_from_float(method, prec, exprange, restricted_range, itr, stat):
 for rounding in RoundModes:
  context.rounding = rounding
  for i in range(1000):
   f = randfloat()
   op = ((f,) if method.startswith('context.') else ('sNaN', f))
   t = TestSet(method, op)
   try:
    if (not convert(t)):
     continue
    callfuncs(t)
    verify(t, stat)
   except VerifyError as err:
    log(err)

def test_from_float ( method , prec , exprange , restricted_range , itr , stat ) : for rounding in RoundModes : context . rounding = rounding for i in range ( 1000 ) : f = randfloat ( ) op = ( ( f , ) if method . startswith ( 'context.' ) else ( 'sNaN' , f ) ) t = TestSet ( method , op ) try : if ( not convert ( t ) ) : continue callfuncs ( t ) verify ( t , stat ) except VerifyError as err : log ( err )
iterate the __float__ method through many test cases .