Coverage for tests/serializers/msgspec/test_encode.py: 100%
11 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-13 05:19 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-13 05:19 +0000
1from typing import Any 1abcdefgh
3import pytest 1abcdefgh
4from msgspec import Struct 1abcdefgh
6from fast_depends.msgspec.serializer import MsgSpecSerializer 1abcdefgh
7from tests.serializers.params import comptex_params, parametrized 1abcdefgh
10class SimpleStruct(Struct): 1abcdefgh
11 r: str 1abcdef
14@pytest.mark.parametrize( 1abcdefgh
15 ("message", "expected_message"),
16 (
17 *parametrized,
18 *comptex_params,
19 pytest.param(
20 SimpleStruct(r="hello!"),
21 b'{"r":"hello!"}',
22 id="struct",
23 ),
24 ),
25)
26def test_encode( 1abcdefgh
27 message: Any,
28 expected_message: bytes,
29) -> None:
30 msg = MsgSpecSerializer.encode(message) 1abcdefgh
31 assert msg == expected_message 1abcdefgh