mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-03 19:10:55 +00:00
Add test reproducing SEGV
This commit is contained in:
parent
e9f9e9e83f
commit
0fa8c102d7
1 changed files with 19 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue