Skip to content

Commit 4ea952f

Browse files
committed
Added unit-test for issue msgpack#28
1 parent 89ce16d commit 4ea952f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/test_obj.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,18 @@ def test_array_hook():
4949
unpacked = unpackb(packed, list_hook=_arr_to_str, use_list=1)
5050
eq_(unpacked, '123')
5151

52+
53+
class DecodeError(Exception):
54+
pass
55+
56+
def bad_complex_decoder(o):
57+
raise DecodeError("Ooops!")
58+
59+
60+
@raises(DecodeError)
61+
def test_an_exception_in_objecthook1():
62+
packed = packb({1: {'__complex__': True, 'real': 1, 'imag': 2}})
63+
unpackb(packed, object_hook=bad_complex_decoder)
64+
5265
if __name__ == '__main__':
5366
main()

0 commit comments

Comments
 (0)