-
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.
- Loading branch information
1 parent
56b0e52
commit 2c470f8
Showing
3 changed files
with
34 additions
and
3 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
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
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,28 @@ | ||
# pyright: reportUnknownParameterType=false | ||
# pyright: reportMissingParameterType=false | ||
# pyright: reportImplicitOverride=false | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
import httpx | ||
|
||
from timeout_executor import serde | ||
|
||
|
||
def test_httpx_reduce_ex(): | ||
def f() -> Any: | ||
try: | ||
httpx.get("http:://invalid/") | ||
except Exception as e: # noqa: BLE001 | ||
return e | ||
return None | ||
|
||
error = f() | ||
assert isinstance(error, httpx.UnsupportedProtocol) | ||
|
||
ser_error = serde.serialize_error(error) | ||
de_error = serde.deserialize_error(ser_error) | ||
|
||
assert isinstance(de_error, httpx.UnsupportedProtocol) | ||
assert hasattr(de_error, "request") |