Skip to content

Commit

Permalink
fix tests, use Pydantic ConfigDict
Browse files Browse the repository at this point in the history
  • Loading branch information
ytausch committed Mar 7, 2024
1 parent 054777a commit 6d86d30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ jobs:
pytest \
-v \
--durations 10 \
tests/model
../tests/model
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
--cov-config=.coveragerc \
--cov-report term-missing \
--durations 10 \
--ignore=tests/model
--ignore=tests/model \
tests
env:
MONGODB_CONNECTION_STRING: "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000"
Expand Down
10 changes: 3 additions & 7 deletions conda_forge_tick/models/common.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import re
from typing import Annotated, Any, Generic, Literal, Never, TypeVar

Check warning on line 2 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L1-L2

Added lines #L1 - L2 were not covered by tests

from pydantic import BaseModel, BeforeValidator, Field, UrlConstraints
from pydantic import BaseModel, BeforeValidator, ConfigDict, Field, UrlConstraints
from pydantic_core import Url

Check warning on line 5 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L4-L5

Added lines #L4 - L5 were not covered by tests

T = TypeVar("T")

Check warning on line 7 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L7

Added line #L7 was not covered by tests


class StrictBaseModel(BaseModel):
class Config:
validate_assignment = True
extra = "forbid"
model_config = ConfigDict(validate_assignment=True, extra="forbid")

Check warning on line 11 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L10-L11

Added lines #L10 - L11 were not covered by tests


class ValidatedBaseModel(BaseModel):
class Config:
validate_assignment = True
extra = "allow"
model_config = ConfigDict(validate_assignment=True, extra="allow")

Check warning on line 15 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L14-L15

Added lines #L14 - L15 were not covered by tests


class Set(StrictBaseModel, Generic[T]):

Check warning on line 18 in conda_forge_tick/models/common.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/models/common.py#L18

Added line #L18 was not covered by tests
Expand Down

0 comments on commit 6d86d30

Please sign in to comment.