mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-06 12:30:58 +00:00
Update README
This commit is contained in:
parent
e0934355c6
commit
ab66c272b0
1 changed files with 3 additions and 2 deletions
|
|
@ -148,6 +148,7 @@ It is also possible to pack/unpack custom data types. Here is an example for
|
||||||
``object_pairs_hook`` callback may instead be used to receive a list of
|
``object_pairs_hook`` callback may instead be used to receive a list of
|
||||||
key-value pairs.
|
key-value pairs.
|
||||||
|
|
||||||
|
|
||||||
Extended types
|
Extended types
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
@ -170,7 +171,7 @@ It is also possible to pack/unpack custom data types using the **ext** type.
|
||||||
... return ExtType(code, data)
|
... return ExtType(code, data)
|
||||||
...
|
...
|
||||||
>>> data = array.array('d', [1.2, 3.4])
|
>>> data = array.array('d', [1.2, 3.4])
|
||||||
>>> packed = msgpack.packb(data, default=default)
|
>>> packed = msgpack.packb(data, default=default, use_bin_type=True)
|
||||||
>>> unpacked = msgpack.unpackb(packed, ext_hook=ext_hook)
|
>>> unpacked = msgpack.unpackb(packed, ext_hook=ext_hook)
|
||||||
>>> data == unpacked
|
>>> data == unpacked
|
||||||
True
|
True
|
||||||
|
|
@ -294,7 +295,7 @@ Test
|
||||||
MessagePack uses `pytest` for testing.
|
MessagePack uses `pytest` for testing.
|
||||||
Run test with following command:
|
Run test with following command:
|
||||||
|
|
||||||
$ py.test
|
$ pytest -v test
|
||||||
|
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue