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.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_pack.py b/test/test_pack.py
index b918f8e..b934dd2 100644
--- a/test/test_pack.py
+++ b/test/test_pack.py
@@ -103,6 +103,21 @@ def testArraySize(sizes=[0, 5, 50, 1000]):
for size in sizes:
assert unpacker.unpack() == list(range(size))
+def test_manualreset(sizes=[0, 5, 50, 1000]):
+ packer = Packer(autoreset=False)
+ for size in sizes:
+ packer.pack_array_header(size)
+ for i in range(size):
+ packer.pack(i)
+
+ bio = six.BytesIO(packer.bytes())
+ unpacker = Unpacker(bio, use_list=1)
+ for size in sizes:
+ assert unpacker.unpack() == list(range(size))
+
+ packer.reset()
+ assert packer.bytes() == b''
+
def testMapSize(sizes=[0, 5, 50, 1000]):
bio = six.BytesIO()
packer = Packer()