Skip to content

Commit

Permalink
chore(ci): update python 3.10 version (pydantic#3000)
Browse files Browse the repository at this point in the history
* chore(ci): update python 3.10 version

* Revert "fix: enum repr is different with 3.10+"

This reverts commit b1c8d9e.
  • Loading branch information
PrettyWood committed Jul 19, 2021
1 parent 945bc11 commit 0c26c1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
fail-fast: false
matrix:
os: [macos, windows]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10.0-beta.2']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10.0-beta.4']
env:
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
Expand Down
7 changes: 1 addition & 6 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,10 @@ class Config:
with pytest.raises(ValidationError) as exc_info:
Model(baz=FooEnum.bar)

if sys.version_info < (3, 10):
enum_repr = "<FooEnum.foo: 'foo_value'>"
else:
enum_repr = 'FooEnum.foo'

assert exc_info.value.errors() == [
{
'loc': ('baz',),
'msg': f'unexpected value; permitted: {enum_repr}',
'msg': "unexpected value; permitted: <FooEnum.foo: 'foo_value'>",
'type': 'value_error.const',
'ctx': {'given': FooEnum.bar, 'permitted': (FooEnum.foo,)},
},
Expand Down
10 changes: 2 additions & 8 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,7 @@ def test_enum_successful():
m = CookingModel(tool=2)
assert m.fruit == FruitEnum.pear
assert m.tool == ToolEnum.wrench
if sys.version_info < (3, 10):
assert repr(m.tool) == '<ToolEnum.wrench: 2>'
else:
assert repr(m.tool) == 'ToolEnum.wrench'
assert repr(m.tool) == '<ToolEnum.wrench: 2>'


def test_enum_fails():
Expand All @@ -858,10 +855,7 @@ def test_enum_fails():
def test_int_enum_successful_for_str_int():
m = CookingModel(tool='2')
assert m.tool == ToolEnum.wrench
if sys.version_info < (3, 10):
assert repr(m.tool) == '<ToolEnum.wrench: 2>'
else:
assert repr(m.tool) == 'ToolEnum.wrench'
assert repr(m.tool) == '<ToolEnum.wrench: 2>'


def test_enum_type():
Expand Down

0 comments on commit 0c26c1c

Please sign in to comment.