Add failing test for TweepError pickle bug.
authorJoshua Roesslein <jroesslein@gmail.com>
Fri, 9 Nov 2012 06:50:09 +0000 (22:50 -0800)
committerJoshua Roesslein <jroesslein@gmail.com>
Fri, 9 Nov 2012 06:50:09 +0000 (22:50 -0800)
A test for the fail case in issue #193.

[ci skip]

tests.py

index e1271fd8f850580618853ce84fce52f26685d83f..8e7aa9bcefd9a92bcf5487da3a975f21c0d1f14f 100644 (file)
--- 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):