diff options
author | INADA Naoki <inada-n@klab.com> | 2012-09-21 14:15:30 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-09-21 14:15:30 +0900 |
commit | 51335bbee4502ac3af81363a10ef6718439377d1 (patch) | |
tree | 175fb5ef98ca964a293a300067baa26bb3f3bf98 /test/test_pack.py | |
parent | 397d772e110ad7000e0952d41c74d8efd322f01f (diff) | |
download | msgpack-python-51335bbee4502ac3af81363a10ef6718439377d1.tar.gz |
packb supports use_single_float option.
Diffstat (limited to 'test/test_pack.py')
-rw-r--r-- | test/test_pack.py | 5 |
1 files changed, 5 insertions, 0 deletions
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() |