code: def test_reader_indexing_1(path, arr):
      # Write the array into a raw data binary file.
      M = np.abs(arr).max()
      arr16 = _to_int16(arr, M)
      unc = _round_trip(path, arr16)
      # Index with many different items.
      N = n_samples
  
      # First, degenerate slices.
      items = [
          slice(start, stop, step)
          for start, stop, step in product(
              (None, 0, 1, -1),
              (None, 0, 1, -1),
              (None, 2, 3, N // 2, N),
          )
      ]
  
      # Other slices with random numbers.
      X = np.random.randint(low=-100, high=2 * N, size=(100, 3))
      items.extend(
          [slice(start, stop, step) for start, stop, step in X]
      )
  
      items.extend(
          [
              (slice(None, None, None),),
              (slice(None, None, None), slice(1, -1, 2)),
              (slice(None, None, None), [1, 5, 3]),
              (slice(None, None, None), 1),
              (1, slice(None, None, None)),
              (2, 1),
          ]
      )
  
      # Single integers.
      items.extend([0, 1, N - 2, N - 1])  # N, N + 1, -1, -2])
      items.extend(np.random.randint(low=-N, high=N, size=100).tolist())
  
      # For every item, check the decompression.
      for s in items:
          if (
              isinstance(s, slice)
              and s.step is not None
              and s.step <= 0
          ):
              continue
          # If the indexing fails, ensures the same indexing fails on the Reader.
          try:
              expected = arr16[s]
          except IndexError:
              with raises(IndexError):
                  unc[s]
                  continue
          sliced = unc[s]
          assert sliced.dtype == expected.dtype
          assert sliced.shape == expected.shape
          assert np.array_equal(sliced, expected)
          assert np.allclose(_from_int16(sliced, M), arr[s], atol=1e-4)
  
imports: from contextlib import redirect_stdout
  import io
  from itertools import product
  import json
  import hashlib
  import logging
  import os
  import os.path
  from pathlib import Path
  import re
  import numpy
  from pytest import fixture, raises, mark
  import mtscomp
  from mtscomp import add_default_handler, Writer, Reader, load_raw_data, diff_along_axis, cumsum_along_axis, mtscomp_parser, mtsdecomp_parser, _args_to_config, read_config, compress, decompress, mtsdesc, mtscomp, mtsdecomp, mtschop, CHECK_ATOL
label_desc: Use image node_id 22 for calling a global function with example usage: test_reader_indexing_1(path, arr) without return types