summaryrefslogtreecommitdiff
path: root/test/test_obj.py
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2010-10-26 02:09:52 +0900
committerINADA Naoki <songofacandy@gmail.com>2010-10-26 02:09:52 +0900
commit3d8978417a177c280b837d72054848e8dd4bc649 (patch)
treeae5a2911d998b9096ae4f0e395070c2ca434ec97 /test/test_obj.py
parent0076d42a0ddeb3601f1a0c806c7874da2110a986 (diff)
downloadmsgpack-python-3d8978417a177c280b837d72054848e8dd4bc649.tar.gz
Add list_hook option to unpacker.
Diffstat (limited to 'test/test_obj.py')
-rw-r--r--test/test_obj.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_obj.py b/test/test_obj.py
index 28edacb..bc85736 100644
--- a/test/test_obj.py
+++ b/test/test_obj.py
@@ -31,7 +31,16 @@ def test_bad_hook():
packed = packs([3, 1+2j], default=lambda o: o)
unpacked = unpacks(packed)
+def _arr_to_str(arr):
+ return ''.join(str(c) for c in arr)
+
+def test_array_hook():
+ packed = packs([1,2,3])
+ unpacked = unpacks(packed, list_hook=_arr_to_str)
+ eq_(unpacked, '123')
+
if __name__ == '__main__':
test_decode_hook()
test_encode_hook()
test_bad_hook()
+ test_array_hook()