File: test_messages.py

package info (click to toggle)
pyotgw 2.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 408 kB
  • sloc: python: 4,580; sh: 5; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Tests for pyotgw/messages.py"""

import pyotgw.messages as m
from pyotgw.messageprocessor import MessageProcessor


def test_message_registry():
    """Test message registry values."""
    for msgid, processing in m.REGISTRY.items():
        assert 0 <= int.from_bytes(msgid, "big") < 128
        assert isinstance(processing[m.M2S], list)
        assert isinstance(processing[m.S2M], list)

        for action in [*processing[m.M2S], *processing[m.S2M]]:
            assert hasattr(MessageProcessor, action[m.FUNC])
            assert isinstance(action[m.ARGS], tuple)
            assert isinstance(action[m.RETURNS], tuple)