Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Sep 25, 2024
1 parent 29c58c7 commit fe17ecf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions antarest/study/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pathlib import Path

from antares.study.version import StudyVersion
from pydantic import BaseModel, field_validator, field_serializer
from pydantic import BaseModel, field_serializer, field_validator
from sqlalchemy import ( # type: ignore
Boolean,
Column,
Expand Down Expand Up @@ -359,7 +359,7 @@ class StudyMetadataDTO(BaseModel):
folder: t.Optional[str] = None
tags: t.List[str] = []

@field_serializer('version')
@field_serializer("version")
def serialize_version(self, version: StudyVersion) -> int:
return version.__int__()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pathlib import Path

from antares.study.version import StudyVersion
from pydantic import BaseModel, Field, model_validator, field_serializer, field_validator
from pydantic import BaseModel, Field, field_serializer, field_validator, model_validator

from antarest.core.utils.utils import DTO
from antarest.study.business.enum_ignore_case import EnumIgnoreCase
Expand Down Expand Up @@ -318,15 +318,14 @@ class FileStudyTreeConfigDTO(BaseModel):
enr_modelling: str = str(EnrModelling.AGGREGATED)
zip_path: t.Optional[Path] = None

@field_serializer('version')
@field_serializer("version")
def serialize_version(self, version: StudyVersion) -> int:
return version.__int__()

@field_validator("version", mode="before")
def _validate_version(cls, v: t.Any) -> StudyVersion:
return StudyVersion.parse(v)


@staticmethod
def from_build_config(
config: FileStudyTreeConfig,
Expand Down

0 comments on commit fe17ecf

Please sign in to comment.