forked from ionelmc/python-tblib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for custom __reduce__, __reduce_ex__ and specifically issue ion…
…elmc#65 Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
- Loading branch information
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pickle | ||
|
||
from tblib import pickling_support | ||
|
||
|
||
class HTTPrettyError(Exception): | ||
pass | ||
|
||
|
||
class UnmockedError(HTTPrettyError): | ||
def __init__(self): | ||
super().__init__('No mocking was registered, and real connections are not allowed (httpretty.allow_net_connect = False).') | ||
|
||
|
||
def test_65(): | ||
pickling_support.install() | ||
|
||
try: | ||
raise UnmockedError | ||
except Exception as e: | ||
exc = e | ||
|
||
exc = pickle.loads(pickle.dumps(exc)) | ||
|
||
assert isinstance(exc, UnmockedError) | ||
assert exc.args == ('No mocking was registered, and real connections are not allowed (httpretty.allow_net_connect = False).',) | ||
assert exc.__traceback__ is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters