Skip to content

Commit bc9ada5

Browse files
author
Lou Kratz
committed
Test error propogation
1 parent 7efc3e8 commit bc9ada5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1+
import asyncio
2+
13
import boto3
4+
import pytest
5+
26
from phoenix.evals import BedrockModel
37

48

59
def test_bedrock_model_can_be_instantiated():
610
session = boto3.Session(region_name="us-west-2")
711
model = BedrockModel(session=session)
812
assert model
13+
14+
15+
def test_bedrock_async_propagates_errors():
16+
with pytest.raises(
17+
AttributeError, match="'NoneType' object has no attribute 'invoke_model'"
18+
):
19+
session = boto3.Session(region_name="us-west-2")
20+
client = session.client("bedrock-runtime")
21+
model = BedrockModel(session=session, client=client)
22+
23+
# Sets client to None to force an exception
24+
model.client = None
25+
26+
# this should raise an exception
27+
asyncio.run(model._async_generate("prompt"))

0 commit comments

Comments
 (0)