Skip to content

Commit 9f244c0

Browse files
committed
Add failing test for TweepError pickle bug.
A test for the fail case in issue tweepy#193. [ci skip]
1 parent b852f8e commit 9f244c0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818

1919
"""Unit tests"""
2020

21+
class TweepyErrorTests(unittest.TestCase):
22+
23+
def testpickle(self):
24+
"""Verify exceptions can be pickled and unpickled."""
25+
import pickle
26+
from tweepy.error import TweepError
27+
28+
e = TweepError('no reason', {'status': 200})
29+
e2 = pickle.loads(pickle.dumps(e))
30+
31+
self.assertEqual(e.reason, e2.reason)
32+
self.assertEqual(e.response, e2.response)
2133

2234
class TweepyAPITests(unittest.TestCase):
2335

0 commit comments

Comments
 (0)