summaryrefslogtreecommitdiff
path: root/test/test_pack.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_pack.py')
-rw-r--r--test/test_pack.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/test_pack.py b/test/test_pack.py
index b447f9c..4608083 100644
--- a/test/test_pack.py
+++ b/test/test_pack.py
@@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import struct
from pytest import raises, xfail
-from msgpack import packb, unpackb, Unpacker, Packer
+from msgpack import packb, unpackb, Unpacker, Packer, pack
from collections import OrderedDict
from io import BytesIO
@@ -148,3 +148,13 @@ def test_pairlist():
packed = packer.pack_map_pairs(pairlist)
unpacked = unpackb(packed, object_pairs_hook=list)
assert pairlist == unpacked
+
+def test_get_buffer():
+ packer = Packer(autoreset=0, use_bin_type=True)
+ packer.pack([1, 2])
+ strm = BytesIO()
+ strm.write(packer.getbuffer())
+ written = strm.getvalue()
+
+ expected = packb([1, 2], use_bin_type=True)
+ assert written == expected