summaryrefslogtreecommitdiff
path: root/test/test_pack.py
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2012-09-21 14:15:30 +0900
committerINADA Naoki <inada-n@klab.com>2012-09-21 14:15:30 +0900
commit51335bbee4502ac3af81363a10ef6718439377d1 (patch)
tree175fb5ef98ca964a293a300067baa26bb3f3bf98 /test/test_pack.py
parent397d772e110ad7000e0952d41c74d8efd322f01f (diff)
downloadmsgpack-python-51335bbee4502ac3af81363a10ef6718439377d1.tar.gz
packb supports use_single_float option.
Diffstat (limited to 'test/test_pack.py')
-rw-r--r--test/test_pack.py5
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()