File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
src/snowflake/connector/aio Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,21 @@ def __init__(
117117 connections_file_path : pathlib .Path | None = None ,
118118 ** kwargs ,
119119 ) -> None :
120+ """Create a new SnowflakeConnection.
121+
122+ Connections can be loaded from the TOML file located at
123+ snowflake.connector.constants.CONNECTIONS_FILE.
124+
125+ When connection_name is supplied we will first load that connection
126+ and then override any other values supplied.
127+
128+ When no arguments are given (other than connection_file_path) the
129+ default connection will be loaded first. Note that no overwriting is
130+ supported in this case.
131+
132+ If overwriting values from the default connection is desirable, supply
133+ the name explicitly.
134+ """
120135 # note we don't call super here because asyncio can not/is not recommended
121136 # to perform async operation in the __init__ while in the sync connection we
122137 # perform connect
Original file line number Diff line number Diff line change @@ -1812,12 +1812,19 @@ async def test_connect_metadata_preservation():
18121812 except Exception as e :
18131813 pytest .fail (f"inspect.signature(connect) failed: { e } " )
18141814
1815- # Test 7: Check __doc__ is preserved on the instance
1816- # Note: inspect.getdoc() doesn't work reliably on instances, so we check __doc__ directly
1817- assert hasattr ( connect , "__doc__" ), "connect instance should have __doc__ attribute"
1818- assert (
1819- connect . __doc__ == SnowflakeConnection .__init__ . __doc__
1820- ), "connect.__doc__ should match SnowflakeConnection.__init__.__doc__ on the instance"
1815+ # Test 7: Check inspect.getdoc works correctly
1816+ connect_doc = inspect .getdoc (connect )
1817+ source_doc = inspect . getdoc ( SnowflakeConnection . __init__ )
1818+ assert connect_doc == source_doc , (
1819+ "inspect.getdoc(connect) should match inspect.getdoc( SnowflakeConnection.__init__)"
1820+ )
18211821
18221822 # Test 8: Check that connect is callable and returns expected type
18231823 assert callable (connect ), "connect should be callable"
1824+
1825+ # Test 9: Verify the instance has proper introspection capabilities
1826+ # IDEs and type checkers should be able to resolve parameters
1827+ sig = inspect .signature (connect )
1828+ params = list (sig .parameters .keys ())
1829+ assert len (params ) > 0 , "connect should have parameters from SnowflakeConnection.__init__"
1830+
You can’t perform that action at this time.
0 commit comments