mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-03 11:00:55 +00:00
packb supports use_single_float option.
This commit is contained in:
parent
397d772e11
commit
51335bbee4
3 changed files with 16 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue