77 InterfaceError ,
88 NotSupportedError ,
99)
10- from mssql_python .async_query import AsyncConnection , AsyncCursor
10+ from mssql_python .async_query import _AsyncConnection # pyright: ignore[reportPrivateUsage]
11+ from mssql_python .async_query import _AsyncCursor # pyright: ignore[reportPrivateUsage]
1112from mssql_python .async_query ._connection_context import build_async_connection_context
1213from mssql_python .helpers import connstr_to_pycore_params
1314
1415
1516@pytest .mark .asyncio
1617async def test_connect_accepts_login_options_with_real_py_core (async_connection_string ):
17- connection = await AsyncConnection .connect (
18+ connection = await _AsyncConnection .connect (
1819 async_connection_string ,
1920 autocommit = True ,
2021 timeout = 12 ,
@@ -24,14 +25,14 @@ async def test_connect_accepts_login_options_with_real_py_core(async_connection_
2425 assert connection .autocommit is True
2526 assert connection .closed is False
2627 assert connection .is_connected () is True
27- assert repr (connection ) == "AsyncConnection (connected)"
28+ assert repr (connection ) == "_AsyncConnection (connected)"
2829 finally :
2930 await connection .close ()
3031
3132
3233@pytest .mark .asyncio
3334async def test_connect_defaults_autocommit_to_false (async_connection_string ):
34- connection = await AsyncConnection .connect (async_connection_string )
35+ connection = await _AsyncConnection .connect (async_connection_string )
3536 try :
3637 assert connection .autocommit is False
3738 finally :
@@ -268,7 +269,7 @@ def test_async_connection_rejects_missing_server():
268269@pytest .mark .asyncio
269270async def test_connection_exposes_complete_native_surface (async_connection ):
270271 cursor = async_connection .cursor ()
271- assert isinstance (cursor , AsyncCursor )
272+ assert isinstance (cursor , _AsyncCursor )
272273 assert async_connection .timeout == 0
273274 async_connection .timeout = 12
274275 assert async_connection .timeout == 12
@@ -279,7 +280,7 @@ async def test_connection_exposes_complete_native_surface(async_connection):
279280 with pytest .raises (AttributeError ):
280281 setattr (async_connection , "closed" , True )
281282 assert async_connection .is_connected () is True
282- assert repr (async_connection ) == "AsyncConnection (connected)"
283+ assert repr (async_connection ) == "_AsyncConnection (connected)"
283284
284285 await cursor .close ()
285286 assert await async_connection .commit () is None
@@ -290,7 +291,7 @@ async def test_connection_exposes_complete_native_surface(async_connection):
290291async def test_async_context_manager_returns_wrapper_and_closes_connection (
291292 async_connection_string ,
292293):
293- connection = await AsyncConnection .connect (async_connection_string )
294+ connection = await _AsyncConnection .connect (async_connection_string )
294295
295296 async with connection as entered :
296297 assert entered is connection
@@ -302,19 +303,19 @@ async def test_async_context_manager_returns_wrapper_and_closes_connection(
302303
303304@pytest .mark .asyncio
304305async def test_close_can_be_called_repeatedly (async_connection_string ):
305- connection = await AsyncConnection .connect (async_connection_string )
306+ connection = await _AsyncConnection .connect (async_connection_string )
306307
307308 await connection .close ()
308309 await connection .close ()
309310
310311 assert connection .closed is True
311312 assert connection .is_connected () is False
312- assert repr (connection ) == "AsyncConnection (closed)"
313+ assert repr (connection ) == "_AsyncConnection (closed)"
313314
314315
315316@pytest .mark .asyncio
316317async def test_operations_after_close_translate_native_errors (async_connection_string ):
317- connection = await AsyncConnection .connect (async_connection_string )
318+ connection = await _AsyncConnection .connect (async_connection_string )
318319 await connection .close ()
319320
320321 with pytest .raises (InterfaceError , match = "Connection is closed" ) as cursor_error :
@@ -338,7 +339,7 @@ async def test_operations_after_close_translate_native_errors(async_connection_s
338339async def test_context_manager_preserves_block_exception_and_closes_connection (
339340 async_connection_string ,
340341):
341- connection = await AsyncConnection .connect (async_connection_string )
342+ connection = await _AsyncConnection .connect (async_connection_string )
342343
343344 with pytest .raises (ValueError , match = "user_error_42" ):
344345 async with connection :
0 commit comments