From 51335bbee4502ac3af81363a10ef6718439377d1 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Fri, 21 Sep 2012 14:15:30 +0900 Subject: packb supports use_single_float option. --- test/test_pack.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/test_pack.py') diff --git a/test/test_pack.py b/test/test_pack.py index 898cdb9..85d11a0 100644 --- a/test/test_pack.py +++ b/test/test_pack.py @@ -2,6 +2,7 @@ # coding: utf-8 import six +import struct from nose import main from nose.tools import * from nose.plugins.skip import SkipTest @@ -86,5 +87,9 @@ def testDecodeBinary(): re = unpackb(packb("abc"), encoding=None) assert_equal(re, b"abc") +def testPackFloat(): + assert_equal(packb(1.0, use_single_float=True), b'\xca' + struct.pack('>f', 1.0)) + assert_equal(packb(1.0, use_single_float=False), b'\xcb' + struct.pack('>d', 1.0)) + if __name__ == '__main__': main() -- cgit v1.2.1