From: Joshua Roesslein Date: Fri, 9 Nov 2012 06:50:09 +0000 (-0800) Subject: Add failing test for TweepError pickle bug. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9f244c04307485d3befbe28da3f96c229fe7eba6;p=tweepy.git Add failing test for TweepError pickle bug. A test for the fail case in issue #193. [ci skip] --- 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):