Files
pydase/tests/client/test_proxy_class.py
Mose Müller 243b46aadb test: adds test for ProxyClass
This test timed out before implementing the changes.
2025-06-23 14:09:52 +02:00

23 lines
645 B
Python

import asyncio
from unittest.mock import AsyncMock, call, patch
import pytest
from pydase import components
from pydase.client.proxy_class import ProxyClass
@pytest.mark.asyncio
async def test_serialize_fallback_inside_event_loop() -> None:
loop = asyncio.get_running_loop()
mock_sio = AsyncMock()
proxy = ProxyClass(sio_client=mock_sio, loop=loop, reconnect=lambda: None)
with patch.object(
components.DeviceConnection, "serialize", return_value={"value": {}}
) as mock_fallback:
result = proxy.serialize()
mock_fallback.assert_has_calls(calls=[call(), call()])
assert isinstance(result, dict)