Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya committed Sep 27, 2024
1 parent c9a00a7 commit 894ed6a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_utils.py
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

0 comments on commit 894ed6a

Please sign in to comment.