Skip to content

Commit

Permalink
model test
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanov committed Jul 17, 2024
1 parent 9ef905c commit 4cf8cd7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

from pyftms.serializer import BaseModel, get_serializer, ModelSerializer
from pyftms.models import TreadmillData


@pytest.mark.parametrize(
"model,data,result",
[
(
TreadmillData,
b"\x00\x00\x00\x00",
{"speed_instant": 0},
),
],
)
def test_realtime_data(model: type[BaseModel], data: bytes, result: dict):
s = get_serializer(model)

assert isinstance(s, ModelSerializer)
assert s.deserialize(data)._asdict() == result

0 comments on commit 4cf8cd7

Please sign in to comment.