original_docstring: A patch over the method asyncio.wait.
  
      This fixture patches over asyncio.wait to prevent the test from waiting
      indefinitely.The method is replaced with a new callable that simulates the
      outcome of the asyncio.wait method in order to cover most of the tested function.
      
docstring: A patch over the method asyncio.wait.
  This fixture patches over asyncio.wait to prevent the test from waiting
  indefinitely.The method is replaced with a new callable that simulates the
  outcome of the asyncio.wait method in order to cover most of the tested function.
docstring_tokens: A patch over the method asyncio . wait . This fixture patches over asyncio . wait to prevent the test from waiting indefinitely . The method is replaced with a new callable that simulates the outcome of the asyncio . wait method in order to cover most of the tested function .
code: def patch_asyncio_wait() -> Iterable[Mock]:
      """A patch over the method asyncio.wait.
  
      This fixture patches over asyncio.wait to prevent the test from waiting
      indefinitely.The method is replaced with a new callable that simulates the
      outcome of the asyncio.wait method in order to cover most of the tested function.
      """
  
      class wait:
          def __init__(self):
              self.call_count = 0
              self.threshold = 3
  
          async def __call__(self, awaitables: Set[Awaitable], return_when):
              """Simulates the call to asyncio.wait(return_when=FIRST_COMPLETED).
  
              The call to wait is a (deliberate) race condition. To simulate this and
              test all parts of the code, this method switches it's response depending
              on how many times it's been called.
              """
              for aw in awaitables:
                  await aw
  
              if self.call_count < self.threshold:
                  self.call_count += 1
                  return [list(awaitables)[0]], None
              else:
                  self.call_count += 1
                  return [list(awaitables)[1]], None
  
      with patch(
          "tickit.core.management.schedulers.master.asyncio.wait",
          new_callable=wait,
      ) as mock:
          yield mock
code_tokens: def patch_asyncio_wait ( ) -> Iterable [ Mock ] : class wait : def __init__ ( self ) : self . call_count = 0 self . threshold = 3 async def __call__ ( self , awaitables : Set [ Awaitable ] , return_when ) : """Simulates the call to asyncio.wait(return_when=FIRST_COMPLETED).
  
              The call to wait is a (deliberate) race condition. To simulate this and
              test all parts of the code, this method switches it's response depending
              on how many times it's been called.
              """ for aw in awaitables : await aw if self . call_count < self . threshold : self . call_count += 1 return [ list ( awaitables ) [ 0 ] ] , None else : self . call_count += 1 return [ list ( awaitables ) [ 1 ] ] , None with patch ( "tickit.core.management.schedulers.master.asyncio.wait" , new_callable = wait , ) as mock : yield mock
short_docstring: A patch over the method asyncio.wait.
short_docstring_tokens: A patch over the method asyncio . wait .
comment: """A patch over the method asyncio.wait.
  
      This fixture patches over asyncio.wait to prevent the test from waiting
      indefinitely.The method is replaced with a new callable that simulates the
      outcome of the asyncio.wait method in order to cover most of the tested function.
      """$SEP$"""Simulates the call to asyncio.wait(return_when=FIRST_COMPLETED).
  
              The call to wait is a (deliberate) race condition. To simulate this and
              test all parts of the code, this method switches it's response depending
              on how many times it's been called.
              """