code: def test_read_text(fmt, bs, encoding, include_path):
      if fmt not in utils.compress:
          pytest.skip("compress function not provided for %s" % fmt)
      compress = utils.compress[fmt]
      files2 = {
          k: compress(v.encode(encoding)) for k, v in files.items()
      }
      with filetexts(files2, mode="b"):
          b = read_text(
              ".test.accounts.*.json",
              compression=fmt,
              blocksize=bs,
              encoding=encoding,
          )
          (L,) = compute(b)
          assert "".join(L) == expected
  
          o = read_text(
              sorted(files),
              compression=fmt,
              blocksize=bs,
              encoding=encoding,
              include_path=include_path,
          )
          b = o.pluck(0) if include_path else o
          (L,) = compute(b)
          assert "".join(L) == expected
          if include_path:
              (paths,) = compute(o.pluck(1))
              expected_paths = list(
                  concat(
                      [[k] * v.count("\n") for k, v in files.items()]
                  )
              )
              assert len(paths) == len(expected_paths)
              for path, expected_path in zip(paths, expected_paths):
                  assert path.endswith(expected_path)
  
          blocks = read_text(
              ".test.accounts.*.json",
              compression=fmt,
              blocksize=bs,
              encoding=encoding,
              collection=False,
          )
          L = compute(*blocks)
          assert (
              "".join(line for block in L for line in block) == expected
          )
  
file_path: dask/dask/bag/tests/test_text.py
imports: from __future__ import annotations
  from functools import partial
  import pytest
  from fsspec.compression import compr
  from tlz import concat
  from dask import compute, config
  from dask.bag.text import read_text
  from dask.bytes import utils
  from dask.utils import filetexts
label_desc: Use image node_id 1 for calling a global function with example usage: test_read_text(fmt, bs, encoding, include_path) without return types