code: def test_ends_early_if_request_finish(self):
      q = Mock(
          get=Mock(
              side_effect=[
                  simple_request_prepare("a"),
                  RequestFinish(),
                  simple_request_prepare("b"),
              ]
          )
      )
      done, batch = gather_batch(q, 0.1, 0.1, 100)
      assert done
      assert [f.file_spec["name"] for f in batch] == ["a"]
      assert q.get.call_count == 2
  
imports: import asyncio
  import concurrent.futures
  import dataclasses
  import queue
  import threading
  from typing import TYPE_CHECKING, Iterable, Mapping, Tuple
  from unittest.mock import Mock, call
  import pytest
  from wandb.filesync.step_prepare import Request, RequestFinish, RequestPrepare, ResponsePrepare, StepPrepare, gather_batch
label_desc: Use image node_id 6 for calling the TestGatherBatch obj's underlying member method code with example usage: obj.test_ends_early_if_request_finish() without return types