11# Copyright (c) Microsoft Corporation.
22# Licensed under the MIT license.
33
4- import asyncio
4+ import inspect
55from unittest .mock import AsyncMock , patch
66
77import pytest
@@ -32,7 +32,7 @@ async def async_token_provider():
3232
3333 result = ensure_async_token_provider (async_token_provider )
3434 assert result is async_token_provider
35- assert asyncio .iscoroutinefunction (result )
35+ assert inspect .iscoroutinefunction (result )
3636
3737 def test_sync_token_provider_wrapped (self ):
3838 """Test that synchronous token providers are automatically wrapped."""
@@ -45,7 +45,7 @@ def sync_token_provider():
4545 # Should return a different callable (the wrapper)
4646 assert result is not sync_token_provider
4747 assert callable (result )
48- assert asyncio .iscoroutinefunction (result )
48+ assert inspect .iscoroutinefunction (result )
4949
5050 async def test_wrapped_sync_provider_returns_correct_token (self ):
5151 """Test that wrapped synchronous token provider returns the correct token."""
@@ -147,7 +147,7 @@ def sync_token_provider():
147147 # The api_key should be a callable
148148 api_key_arg = call_kwargs ["api_key" ]
149149 assert callable (api_key_arg )
150- assert asyncio .iscoroutinefunction (api_key_arg )
150+ assert inspect .iscoroutinefunction (api_key_arg )
151151
152152 # Verify the wrapped token provider returns correct value
153153 token = await api_key_arg ()
@@ -234,7 +234,7 @@ def mock_sync_bearer_token_provider():
234234 call_kwargs = mock_openai .call_args [1 ]
235235 wrapped_provider = call_kwargs ["api_key" ]
236236
237- assert asyncio .iscoroutinefunction (wrapped_provider )
237+ assert inspect .iscoroutinefunction (wrapped_provider )
238238
239239 # Verify it returns the correct token
240240 token = await wrapped_provider ()
0 commit comments