MCPcopy Index your code
hub / github.com/msgspec/msgspec / test_replace_errors_unset_fields

Method test_replace_errors_unset_fields

tests/unit/test_struct.py:2309–2319  ·  view source on GitHub ↗
(self, replace)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 2

replaceFunction · 0.85
PointClass · 0.70

Tested by

no test coverage detected