MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_method_signature_comparison

Function test_method_signature_comparison

sdk/python/tests/test_typing.py:124–160  ·  view source on GitHub ↗

Compare method signatures between sync and async versions.

()

Source from the content-addressed store, hash-verified

122
123
124def test_method_signature_comparison():
125 """Compare method signatures between sync and async versions."""
126 sync_client = DstackClient(TEST_ENDPOINT)
127 async_client = AsyncDstackClient(TEST_ENDPOINT)
128
129 methods_to_check = [
130 "get_key",
131 "get_quote",
132 "get_tls_key",
133 "info",
134 "emit_event",
135 "is_reachable",
136 ]
137
138 for method_name in methods_to_check:
139 sync_method = getattr(sync_client, method_name)
140 async_method = getattr(async_client, method_name)
141
142 sync_sig = inspect.signature(sync_method)
143 async_sig = inspect.signature(async_method)
144
145 print(f"\n{method_name}:")
146 print(f" Sync signature: {sync_sig}")
147 print(f" Async signature: {async_sig}")
148
149 # Parameters should be the same (excluding 'self')
150 sync_params = list(sync_sig.parameters.keys())
151 async_params = list(async_sig.parameters.keys())
152
153 if "self" in sync_params:
154 sync_params.remove("self")
155 if "self" in async_params:
156 async_params.remove("self")
157
158 assert sync_params == async_params, (
159 f"Parameter mismatch for {method_name}: sync={sync_params}, async={async_params}"
160 )
161
162
163if __name__ == "__main__":

Callers 1

test_typing.pyFile · 0.85

Calls 4

DstackClientClass · 0.90
AsyncDstackClientClass · 0.90
listFunction · 0.85
removeMethod · 0.45

Tested by

no test coverage detected