mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-01 01:50:54 +00:00
Added unit-test for issue https://github.com/msgpack/msgpack-python/issues/28
This commit is contained in:
parent
89ce16df39
commit
4ea952f39d
1 changed files with 13 additions and 0 deletions
|
|
@ -49,5 +49,18 @@ def test_array_hook():
|
|||
unpacked = unpackb(packed, list_hook=_arr_to_str, use_list=1)
|
||||
eq_(unpacked, '123')
|
||||
|
||||
|
||||
class DecodeError(Exception):
|
||||
pass
|
||||
|
||||
def bad_complex_decoder(o):
|
||||
raise DecodeError("Ooops!")
|
||||
|
||||
|
||||
@raises(DecodeError)
|
||||
def test_an_exception_in_objecthook1():
|
||||
packed = packb({1: {'__complex__': True, 'real': 1, 'imag': 2}})
|
||||
unpackb(packed, object_hook=bad_complex_decoder)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue