ballistica/tests/test_efro/test_message.py
2021-08-16 19:32:49 +02:00

35 lines
746 B
Python

# Released under the MIT License. See LICENSE for details.
#
"""Testing message functionality."""
from __future__ import annotations
from typing import TYPE_CHECKING
# import pytest
from efro.message import MessageProtocol, MessageSender
if TYPE_CHECKING:
pass
def test_message_sending() -> None:
"""Test simple message sending."""
protocol = MessageProtocol(message_types={})
class TestClass:
"""Test."""
def _send_raw_message(self, data: bytes) -> bytes:
"""Test."""
print(f'WOULD SEND RAW MSG OF SIZE {len(data)}')
return b''
msg = MessageSender(protocol, _send_raw_message)
obj = TestClass()
print(f'MADE TEST OBJ {obj}')
obj.msg.send('foo')