(self, proto)
| 2795 | assert "Expected `int`, got `str`" in str(rec.value) |
| 2796 | |
| 2797 | def test_classvars_ignored(self, proto): |
| 2798 | source = """ |
| 2799 | from __future__ import annotations |
| 2800 | |
| 2801 | from typing import ClassVar |
| 2802 | from dataclasses import dataclass |
| 2803 | |
| 2804 | @dataclass |
| 2805 | class Ex: |
| 2806 | a: int |
| 2807 | other: ClassVar[int] |
| 2808 | """ |
| 2809 | with temp_module(source) as mod: |
| 2810 | msg = mod.Ex(a=1) |
| 2811 | dec = proto.Decoder(mod.Ex) |
| 2812 | res = dec.decode(proto.encode({"a": 1, "other": 2})) |
| 2813 | assert res == msg |
| 2814 | assert not hasattr(res, "other") |
| 2815 | |
| 2816 | def test_initvars_forbidden(self, proto): |
| 2817 | source = """ |
nothing calls this directly
no test coverage detected