def parse_testfile(fname):
 with open(fname) as fp:
  for line in fp:
   if (line.startswith('--') or (not line.strip())):
    continue
   (lhs, rhs) = line.split('->')
   (id, fn, arg_real, arg_imag) = lhs.split()
   rhs_pieces = rhs.split()
   (exp_real, exp_imag) = (rhs_pieces[0], rhs_pieces[1])
   flags = rhs_pieces[2:]
   (yield (id, fn, float(arg_real), float(arg_imag), float(exp_real), float(exp_imag), flags))

def parse_testfile ( fname ) : with open ( fname ) as fp : for line in fp : if ( line . startswith ( '--' ) or ( not line . strip ( ) ) ) : continue ( lhs , rhs ) = line . split ( '->' ) ( id , fn , arg_real , arg_imag ) = lhs . split ( ) rhs_pieces = rhs . split ( ) ( exp_real , exp_imag ) = ( rhs_pieces [ 0 ] , rhs_pieces [ 1 ] ) flags = rhs_pieces [ 2 : ] ( yield ( id , fn , float ( arg_real ) , float ( arg_imag ) , float ( exp_real ) , float ( exp_imag ) , flags ) )
parse a file with test values empty lines or lines starting with -- are ignored yields id .