I want to use pydantic as a variable, for example to do this:
bla = ValidationError("msg")
but I get
pydantic.error_wrappers.ValidationError.__init__
TypeError: __init__() takes exactly 3 positional arguments (2 given)
while I see many that uses ValidationError("msg") when using it in a raise context
ultimatly i'm trying to use it in a parametize test like so:
@pytest.mark.parametrize("exception_side_effect, expected_exception, error_message", [
(ProgrammingError("exceeded for unload single file mode."), PeachBaseServiceException, "Too much data fetched for a single file"),
(ValidationError("unexpected error while trying to execute query"), ValidationError, "error loading query results to"),
(Exception("unexpected error while trying to execute query"), Exception, "unexpected error")
])
def test_error_raised(
exception_side_effect: Exception,
expected_exception: Type[Exception],
error_message: str
):
but for some reason i can't write ValidationError("msg") this way