Skip to content

Commit 51114ab

Browse files
committed
fix: improve validation tests for yield usage in OpenAIEmbeddingSpec
1 parent c2b8c68 commit 51114ab

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

tests/unit/test_openai_embedding.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,13 @@ async def test_openai_embedding_spec_with_usage(openai_embedding_request_data):
107107

108108
@pytest.mark.asyncio
109109
async def test_openai_embedding_spec_validation(openai_request_data):
110-
server = ls.LitServer(TestEmbedAPIWithYieldPredict(), spec=OpenAIEmbeddingSpec())
111-
with pytest.raises(ValueError, match="You are using yield in your predict method"), wrap_litserve_start(
112-
server
113-
) as server:
114-
async with LifespanManager(server.app):
115-
pass
116-
117-
server = ls.LitServer(TestEmbedAPIWithYieldEncodeResponse(), spec=OpenAIEmbeddingSpec())
118-
with pytest.raises(ValueError, match="You are using yield in your encode_response method"), wrap_litserve_start(
119-
server
120-
) as server:
121-
async with LifespanManager(server.app):
122-
pass
110+
with pytest.raises(ValueError, match="You are using yield in your predict method"):
111+
ls.LitServer(TestEmbedAPIWithYieldPredict(), spec=OpenAIEmbeddingSpec())
123112

124113

114+
with pytest.raises(ValueError, match="You are using yield in your encode_response method"):
115+
ls.LitServer(TestEmbedAPIWithYieldEncodeResponse(), spec=OpenAIEmbeddingSpec())
116+
125117
@pytest.mark.asyncio
126118
async def test_openai_embedding_spec_with_non_dict_output(openai_embedding_request_data):
127119
server = ls.LitServer(TestEmbedAPIWithNonDictOutput(), spec=ls.OpenAIEmbeddingSpec())

0 commit comments

Comments
 (0)