Skip to content

Commit

Permalink
Merge pull request #25 from workfloworchestrator/upgrade-pydantic
Browse files Browse the repository at this point in the history
Update from upgrade-pydantic
  • Loading branch information
pboers1988 authored Jun 24, 2024
2 parents 5a7e5fa + 0653e07 commit 9da00f1
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.3
current_version = 1.1.0
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((\-rc)(?P<build>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion pydantic_forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

"""Pydantic-forms engine."""

__version__ = "1.0.3"
__version__ = "1.1.0"
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ classifiers = [
]
requires = [
"more-itertools",
"pydantic[email] ~= 2.5.1",
"pydantic~=2.5.1"
"pydantic[email]>=2.7.4"
]
description-file = "README.md"
requires-python = ">=3.9,<=3.13"
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/test_accept.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Form(FormPage):
"format": "accept",
"type": "string",
"title": "Accept",
"metadata": ANY,
}
},
"required": ["accept"],
Expand All @@ -57,7 +56,6 @@ class Form(FormPage):
"format": "accept",
"type": "string",
"title": "Accept",
"metadata": ANY,
}
},
"required": ["accept"],
Expand Down Expand Up @@ -95,6 +93,7 @@ class Form(FormPage):
"loc": ("accept",),
"msg": "Input should be 'ACCEPTED' or 'INCOMPLETE'",
"type": "enum",
"url": "https://errors.pydantic.dev/2.7/v/enum",
}
]
assert error_info.value.errors() == expected
5 changes: 4 additions & 1 deletion tests/unit_tests/test_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,8 @@ class Form(FormPage):
assert validated.model_dump() == {"choice": str(first_uuid)}

# Cannot use the actual UUID because it's a strEnum
with pytest.raises(ValidationError, match=r"choice\n\s+Input should be a valid string"):
with pytest.raises(
ValidationError,
match=r"choice\n\s+Input should be '3a3691e2-399a-4733-8924-2cb524eb4723', 'efadf3f8-da32-475e-8dad-6efffa901bae' or '8724775d-2bfa-43e0-b861-942aa8699e1e'",
):
Form(choice=first_uuid)
2 changes: 1 addition & 1 deletion tests/unit_tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def input_form(state):
with pytest.raises(FormValidationError) as e:
post_form(input_form, {}, [{"generic_select": 1, "extra_data": False}])

expected = "2 validation errors for TestForm\ngeneric_select\n Input should be a valid string (type=string_type)\nextra_data\n Extra inputs are not permitted (type=extra_forbidden)"
expected = "2 validation errors for TestForm\ngeneric_select\n Input should be 'a' or 'b' (type=enum; expected='a' or 'b')\nextra_data\n Extra inputs are not permitted (type=extra_forbidden)"
assert str(e.value) == expected

with pytest.raises(FormValidationError) as e:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_core_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def input_form(state):
with raises(FormValidationError) as e:
await post_form(input_form, {}, [{"generic_select": 1, "extra_data": False}])

expected = "2 validation errors for TestForm\ngeneric_select\n Input should be a valid string (type=string_type)\nextra_data\n Extra inputs are not permitted (type=extra_forbidden)"
expected = "2 validation errors for TestForm\ngeneric_select\n Input should be 'a' or 'b' (type=enum; expected='a' or 'b')\nextra_data\n Extra inputs are not permitted (type=extra_forbidden)"
assert str(e.value) == expected

with raises(FormValidationError) as e:
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/test_read_only_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Form(FormPage):
"read_only": {
"const": schema_value,
"default": schema_value,
"enum": [schema_value],
"title": "Read Only",
"uniforms": {"disabled": True, "value": schema_value},
"type": schema_type,
Expand Down

0 comments on commit 9da00f1

Please sign in to comment.