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

Method test_initvars_forbidden

tests/unit/test_common.py:2816–2827  ·  view source on GitHub ↗
(self, proto)

Source from the content-addressed store, hash-verified

2814 assert not hasattr(res, "other")
2815
2816 def test_initvars_forbidden(self, proto):
2817 source = """
2818 from dataclasses import dataclass, InitVar
2819
2820 @dataclass
2821 class Ex:
2822 a: int
2823 other: InitVar[int]
2824 """
2825 with temp_module(source) as mod:
2826 with pytest.raises(TypeError, match="`InitVar` fields are not supported"):
2827 proto.Decoder(mod.Ex)
2828
2829 @pytest.mark.parametrize("slots", [False, True])
2830 def test_decode_dataclass(self, proto, slots):

Callers

nothing calls this directly

Calls 1

temp_moduleFunction · 0.85

Tested by

no test coverage detected