diff --git a/tests/serialization_test.py b/tests/serialization_test.py index 23c4a2d9..6cf5f8b7 100644 --- a/tests/serialization_test.py +++ b/tests/serialization_test.py @@ -8,11 +8,23 @@ from mitogen.core import b import testlib +class EvilObject(object): + pass + + def roundtrip(v): msg = mitogen.core.Message.pickled(v) return mitogen.core.Message(data=msg.data).unpickle() +class EvilObjectTest(testlib.TestCase): + def test_deserialization_fails(self): + msg = mitogen.core.Message.pickled(EvilObject()) + e = self.assertRaises(mitogen.core.StreamError, + lambda: msg.unpickle() + ) + + class BlobTest(testlib.TestCase): klass = mitogen.core.Blob