(self, replace)
| 2307 | replace(p, oops=3) |
| 2308 | |
| 2309 | def test_replace_errors_unset_fields(self, replace): |
| 2310 | p = Point(1, 2) |
| 2311 | del p.x |
| 2312 | |
| 2313 | with pytest.raises(AttributeError, match="Struct field 'x' is unset"): |
| 2314 | replace(p) |
| 2315 | |
| 2316 | with pytest.raises(AttributeError, match="Struct field 'x' is unset"): |
| 2317 | replace(p, y=1) |
| 2318 | |
| 2319 | assert replace(p, x=3) == Point(3, 2) |
| 2320 | |
| 2321 | def test_replace_frozen(self, replace): |
| 2322 | class Test(msgspec.Struct, frozen=True): |