def test_unpack(): for expected, size, bigendian, input in testcases: print "test_unpack:", expected, size, bigendian assert len(input) == size res = unpack_float(input, bigendian) if isnan(res) and isnan(expected): pass else: if size == 8: assert res == expected # exact result expected else: assert res == expected or abs(res - expected) < 1e-6
def test_unpack(): for expected, size, bigendian, input in testcases: print 'test_unpack:', expected, size, bigendian assert len(input) == size res = unpack_float(input, bigendian) if isnan(res) and isnan(expected): pass else: if size == 8: assert res == expected # exact result expected else: assert res == expected or abs(res - expected) < 1E-6
def make_float_unpacker(size): return lambda fmtiter: fmtiter.appendobj(ieee.unpack_float( fmtiter.read(size), fmtiter.bigendian))
def unpack_float(s): return ieee.unpack_float(s, False)
def make_float_unpacker(size): return lambda fmtiter: fmtiter.appendobj( ieee.unpack_float(fmtiter.read(size), fmtiter.bigendian))