@@ -1195,16 +1195,16 @@ def test_create_connection_happy_eyeballs_empty_exceptions(self, m_socket):
11951195 # Test for gh-135836: Fix IndexError when Happy Eyeballs algorithm
11961196 # results in empty exceptions list
11971197 from unittest import mock
1198-
1198+
11991199 async def getaddrinfo (* args , ** kw ):
12001200 return [(socket .AF_INET , socket .SOCK_STREAM , 0 , '' , ('127.0.0.1' , 80 )),
12011201 (socket .AF_INET6 , socket .SOCK_STREAM , 0 , '' , ('::1' , 80 ))]
1202-
1202+
12031203 def getaddrinfo_task (* args , ** kwds ):
12041204 return self .loop .create_task (getaddrinfo (* args , ** kwds ))
1205-
1205+
12061206 self .loop .getaddrinfo = getaddrinfo_task
1207-
1207+
12081208 # Mock staggered_race to return empty exceptions list
12091209 # This simulates the scenario where Happy Eyeballs algorithm
12101210 # cancels all attempts but doesn't properly collect exceptions
@@ -1213,10 +1213,10 @@ def getaddrinfo_task(*args, **kwds):
12131213 async def mock_race (coro_fns , delay , loop ):
12141214 return None , []
12151215 mock_staggered .side_effect = mock_race
1216-
1216+
12171217 coro = self .loop .create_connection (
12181218 MyProto , 'example.com' , 80 , happy_eyeballs_delay = 0.1 )
1219-
1219+
12201220 # Should raise TimeoutError instead of IndexError
12211221 with self .assertRaises (TimeoutError ):
12221222 self .loop .run_until_complete (coro )
0 commit comments