Skip to content

Commit dd22d3f

Browse files
author
Ana Falcao
committed
change error message
1 parent 6106aed commit dd22d3f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tests/functional/parser/test_parser.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ class NonPydanticModel:
195195
pass
196196

197197
def test_event_parser_invalid_model_type():
198-
"""Test that event_parser raises InvalidModelTypeError when given an invalid model type"""
198+
class NonPydanticModel:
199+
pass
200+
201+
class NonPydanticEnvelope:
202+
pass
203+
199204
event = {"id": 123, "breed": "Staffie", "bath": False}
200205

201206
@event_parser(model=NonPydanticModel)
@@ -205,17 +210,18 @@ def handler(event, _):
205210
# Test direct handler invocation
206211
with pytest.raises(exceptions.InvalidModelTypeError) as exc_info:
207212
handler(event, None)
208-
assert "Please ensure" in str(exc_info.value)
213+
assert "unable to be validated" in str(exc_info.value)
209214

210-
# Test parse function
215+
# Test parse function with invalid model
211216
with pytest.raises(exceptions.InvalidModelTypeError) as exc_info:
212217
parse(event=event, model=NonPydanticModel)
213-
assert "Please ensure" in str(exc_info.value)
218+
assert "unable to be validated" in str(exc_info.value)
214219

215-
# Test with both model and envelope
220+
# Test parse function with invalid envelope
216221
with pytest.raises(exceptions.InvalidEnvelopeError) as exc_info:
217-
parse(event=event, model=NonPydanticModel, envelope=NonPydanticModel)
218-
assert "Please ensure" in str(exc_info.value)
222+
parse(event=event, model=NonPydanticModel, envelope=NonPydanticEnvelope)
223+
assert "Error" in str(exc_info.value)
224+
219225

220226
@pytest.mark.parametrize(
221227
"test_input,expected",

0 commit comments

Comments
 (0)