(ModelTwo, copy_method)
| 281 | |
| 282 | |
| 283 | def test_copy_update(ModelTwo, copy_method): |
| 284 | m = ModelTwo(a=24, d=Model(a='12')) |
| 285 | m2 = copy_method(m, update={'a': 'different'}) |
| 286 | |
| 287 | assert m.a == 24 |
| 288 | assert m2.a == 'different' |
| 289 | m_keys = m.model_dump().keys() |
| 290 | with pytest.warns( |
| 291 | UserWarning, |
| 292 | match=r"Expected `float` - serialized value may not be as expected \[field_name='a', input_value='different', input_type=str\]", |
| 293 | ): |
| 294 | m2_keys = m2.model_dump().keys() |
| 295 | assert set(m_keys) == set(m2_keys) == {'a', 'b', 'c', 'd'} |
| 296 | assert m != m2 |
| 297 | |
| 298 | |
| 299 | def test_copy_update_unset(copy_method): |
nothing calls this directly
no test coverage detected