diff options
author | INADA Naoki <inada-n@klab.com> | 2012-12-22 12:12:32 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-12-22 12:12:32 +0900 |
commit | 0fa8c102d7f8ed618284e1b039fa867cfd9baa2f (patch) | |
tree | e405d482f0a3df3d8dc59fc668041ea6b900faee /test | |
parent | e9f9e9e83ff5b69e7aab5384d9cb507363dd88e3 (diff) | |
download | msgpack-python-0fa8c102d7f8ed618284e1b039fa867cfd9baa2f.tar.gz |
Add test reproducing SEGV
Diffstat (limited to 'test')
-rw-r--r-- | test/test_except.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_except.py b/test/test_except.py index ad02cb6..e142dd6 100644 --- a/test/test_except.py +++ b/test/test_except.py @@ -6,9 +6,28 @@ from msgpack import packb, unpackb import datetime +class DummyException(Exception): + pass + + def test_raise_on_find_unsupported_value(): assert_raises(TypeError, packb, datetime.datetime.now()) + +def test_raise_from_object_hook(): + def hook(obj): + raise DummyException + assert_raises(DummyException, unpackb, packb({}), object_hook=hook) + assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}), + object_hook=hook) + assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}), + object_pairs_hook=hook) + assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}), + object_hook=hook) + assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}), + object_pairs_hook=hook) + + if __name__ == '__main__': from nose import main main() |