Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.6 Changeset: r93377:abab5c6e2946 Date: 2017-12-11 20:29 +0100 http://bitbucket.org/pypy/pypy/changeset/abab5c6e2946/
Log: Check that the 'e' format works in the struct module. diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py --- a/pypy/module/struct/test/test_struct.py +++ b/pypy/module/struct/test/test_struct.py @@ -49,6 +49,7 @@ assert calcsize('=Q') == 8 assert calcsize('<f') == 4 assert calcsize('>d') == 8 + assert calcsize('<d') == 2 assert calcsize('!13s') == 13 assert calcsize('=500p') == 500 # test with some repetitions and multiple format characters @@ -256,6 +257,14 @@ assert unpack("<f", b'\x00\x00H\xc1') == (-12.5,) raises(OverflowError, pack, "<f", 10e100) + def test_half_floats(self): + pack = self.struct.pack + unpack = self.struct.unpack + assert pack("<e", 65504.0) == b'\xff\x7b' + assert pack(">e", 65504.0) == b'\x7b\xff' + assert unpack(">e", b'\x7b\xff') == (65504.0,) + raises(OverflowError, pack, "<e", 1e6) + def test_bool(self): pack = self.struct.pack assert pack("!?", True) == b'\x01' _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit