()
| 147 | |
| 148 | |
| 149 | def test_unknown_fields() -> None: |
| 150 | m1 = BasicModel.construct(foo="foo", unknown=1) |
| 151 | assert m1.foo == "foo" |
| 152 | assert cast(Any, m1).unknown == 1 |
| 153 | |
| 154 | m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True}) |
| 155 | assert m2.foo == "foo" |
| 156 | assert cast(Any, m2).unknown == {"foo_bar": True} |
| 157 | |
| 158 | assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}} |
| 159 | |
| 160 | |
| 161 | def test_strict_validation_unknown_fields() -> None: |
nothing calls this directly
no test coverage detected