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

Method test_force_setattr

tests/unit/test_struct.py:1632–1646  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1630 assert gc.is_tracked(t)
1631
1632 def test_force_setattr(self):
1633 class Ex(Struct, frozen=True):
1634 x: Any
1635
1636 obj = Ex(1)
1637
1638 res = msgspec.structs.force_setattr(obj, "x", 2)
1639 assert res is None
1640 assert obj.x == 2
1641
1642 with pytest.raises(AttributeError):
1643 msgspec.structs.force_setattr(obj, "oops", 3)
1644
1645 with pytest.raises(TypeError):
1646 msgspec.structs.force_setattr(1, "oops", 3)
1647
1648
1649class TestOrderAndEq:

Callers

nothing calls this directly

Calls 1

ExClass · 0.70

Tested by

no test coverage detected