(
self,
use_construct: bool,
validate_by_name_config: bool,
arg_name: str,
expectation: AbstractContextManager,
)
| 320 | ], |
| 321 | ) |
| 322 | def test_validate_by_name_config( |
| 323 | self, |
| 324 | use_construct: bool, |
| 325 | validate_by_name_config: bool, |
| 326 | arg_name: str, |
| 327 | expectation: AbstractContextManager, |
| 328 | ): |
| 329 | expected_value: int = 7 |
| 330 | |
| 331 | class Foo(BaseModel): |
| 332 | bar_: int = Field(alias='bar') |
| 333 | |
| 334 | model_config = dict(validate_by_name=validate_by_name_config) |
| 335 | |
| 336 | with expectation: |
| 337 | if use_construct: |
| 338 | f = Foo.model_construct(**{arg_name: expected_value}) |
| 339 | else: |
| 340 | f = Foo(**{arg_name: expected_value}) |
| 341 | assert f.bar_ == expected_value |
| 342 | |
| 343 | def test_immutable_copy_with_frozen(self): |
| 344 | class Model(BaseModel): |
nothing calls this directly
no test coverage detected