"""_SyncProxy introspection: dir() and help()/signature must work through the proxy.""" import asyncio import inspect from unittest.mock import AsyncMock from pm3py.core.client import _SyncProxy from pm3py.core.hf_iso15 import HF15Commands def _proxy(): return _SyncProxy(HF15Commands(AsyncMock()), asyncio.new_event_loop()) def test_dir_surfaces_target_methods(): d = dir(_proxy()) for name in ("scan", "rdbl", "wrbl", "raw_inventory", "sniff"): assert name in d, f"{name} missing from dir(proxy)" def test_wrapped_method_preserves_signature(): proxy = _proxy() # signature must be the real params, not the wrapper's (*args, **kwargs) sig = inspect.signature(proxy.rdbl) assert list(sig.parameters) == ["block", "uid"] assert sig.parameters["uid"].default is None def test_wrapped_method_preserves_doc_and_name(): proxy = _proxy() assert proxy.rdbl.__name__ == "rdbl" assert proxy.rdbl.__doc__ == "Read a single block."