From 9f244c04307485d3befbe28da3f96c229fe7eba6 Mon Sep 17 00:00:00 2001 From: Joshua Roesslein Date: Thu, 8 Nov 2012 22:50:09 -0800 Subject: [PATCH] Add failing test for TweepError pickle bug. A test for the fail case in issue #193. [ci skip] --- tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests.py b/tests.py index e1271fd..8e7aa9b 100644 --- a/tests.py +++ b/tests.py @@ -18,6 +18,18 @@ test_tweet_id = '266367358078169089' """Unit tests""" +class TweepyErrorTests(unittest.TestCase): + + def testpickle(self): + """Verify exceptions can be pickled and unpickled.""" + import pickle + from tweepy.error import TweepError + + e = TweepError('no reason', {'status': 200}) + e2 = pickle.loads(pickle.dumps(e)) + + self.assertEqual(e.reason, e2.reason) + self.assertEqual(e.response, e2.response) class TweepyAPITests(unittest.TestCase): -- 2.25.1