-
Notifications
You must be signed in to change notification settings - Fork 157
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
c9a00a7
commit 894ed6a
Showing
1 changed file
with
15 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,15 @@ | ||
import pickle | ||
|
||
from fastapi import HTTPException | ||
|
||
from litserve.utils import dump_exception | ||
|
||
|
||
def test_dump_exception(): | ||
e1 = dump_exception(HTTPException(status_code=404, detail="Not Found")) | ||
assert isinstance(e1, bytes) | ||
|
||
exc = HTTPException(400, "Custom Lit error") | ||
isinstance(pickle.loads(dump_exception(exc)), HTTPException) | ||
assert pickle.loads(dump_exception(exc)).detail == "Custom Lit error" | ||
assert pickle.loads(dump_exception(exc)).status_code == 400 |