code: def test_read_block():
      delimiter = b"\n"
      data = delimiter.join([b"123", b"456", b"789"])
      f = io.BytesIO(data)
  
      assert read_block(f, 1, 2) == b"23"
      assert read_block(f, 0, 1, delimiter=b"\n") == b"123\n"
      assert read_block(f, 0, 2, delimiter=b"\n") == b"123\n"
      assert read_block(f, 0, 3, delimiter=b"\n") == b"123\n"
      assert read_block(f, 0, 5, delimiter=b"\n") == b"123\n456\n"
      assert read_block(f, 0, 8, delimiter=b"\n") == b"123\n456\n789"
      assert read_block(f, 0, 100, delimiter=b"\n") == b"123\n456\n789"
      assert read_block(f, 1, 1, delimiter=b"\n") == b""
      assert read_block(f, 1, 5, delimiter=b"\n") == b"456\n"
      assert read_block(f, 1, 8, delimiter=b"\n") == b"456\n789"
  
      for ols in [
          [(0, 3), (3, 3), (6, 3), (9, 2)],
          [(0, 4), (4, 4), (8, 4)],
      ]:
          out = [read_block(f, o, l, b"\n") for o, l in ols]
          assert b"".join(filter(None, out)) == data
  
file_path: dask/dask/bytes/tests/test_bytes_utils.py
imports: from __future__ import annotations
  import io
  import os
  import pathlib
  import pytest
  from fsspec.utils import infer_storage_options, read_block, seek_delimiter, stringify_path
label_desc: Use image node_id 1 for calling a global function with example usage: test_read_block() without return types