diff options
author | Alexei Romanoff <drednout.by@gmail.com> | 2012-10-12 12:34:18 +0300 |
---|---|---|
committer | Alexei Romanoff <drednout.by@gmail.com> | 2012-10-12 12:34:18 +0300 |
commit | 4ea952f39dc5ff1231f780252d8d4efb16b2be3b (patch) | |
tree | 8c5f9f2657fc858f69f305c5ffc7efd74b220a75 /test/test_obj.py | |
parent | 89ce16df39f67ac77785a63b4111c353f0a606a3 (diff) | |
download | msgpack-python-4ea952f39dc5ff1231f780252d8d4efb16b2be3b.tar.gz |
Added unit-test for issue https://github.com/msgpack/msgpack-python/issues/28
Diffstat (limited to 'test/test_obj.py')
-rw-r--r-- | test/test_obj.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_obj.py b/test/test_obj.py index 881e627..15e192c 100644 --- a/test/test_obj.py +++ b/test/test_obj.py @@ -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() |