code: def test_compute(
      app_config: AppConfig,
      get_job_runner: GetJobRunner,
      get_parquet_and_info_job_runner: GetParquetAndInfoJobRunner,
      hub_responses_descriptive_statistics: HubDatasetTest,
      hub_responses_descriptive_statistics_string_text: HubDatasetTest,
      hub_responses_gated_descriptive_statistics: HubDatasetTest,
      hub_responses_audio: HubDatasetTest,
      hub_responses_big: HubDatasetTest,
      hub_dataset_name: str,
      expected_error_code: Optional[str],
      descriptive_statistics_expected: dict,  # type: ignore
      descriptive_statistics_string_text_expected: dict,  # type: ignore
  ) -> None:
      hub_datasets = {
          "descriptive_statistics": hub_responses_descriptive_statistics,
          "descriptive_statistics_partial": hub_responses_descriptive_statistics,
          "descriptive_statistics_string_text": hub_responses_descriptive_statistics_string_text,
          "gated": hub_responses_gated_descriptive_statistics,
          "audio": hub_responses_audio,
          "big": hub_responses_big,
      }
      expected = {
          "descriptive_statistics": descriptive_statistics_expected,
          "descriptive_statistics_partial": descriptive_statistics_expected,
          "gated": descriptive_statistics_expected,
          "descriptive_statistics_string_text": descriptive_statistics_string_text_expected,
      }
      dataset = hub_datasets[hub_dataset_name]["name"]
      splits_response = hub_datasets[hub_dataset_name][
          "splits_response"
      ]
      config, split = (
          splits_response["splits"][0]["config"],
          splits_response["splits"][0]["split"],
      )
      expected_response = expected.get(hub_dataset_name)
  
      partial = hub_dataset_name.endswith("_partial")
      app_config = (
          app_config
          if not partial
          else replace(
              app_config,
              parquet_and_info=replace(
                  app_config.parquet_and_info,
                  max_dataset_size_bytes=1,
                  max_row_group_byte_size_for_copy=1,
              ),
          )
      )
  
      # computing and pushing real parquet files because we need them for stats computation
      parquet_job_runner = get_parquet_and_info_job_runner(
          dataset, config, app_config
      )
      parquet_and_info_response = parquet_job_runner.compute()
      assert parquet_and_info_response
      assert parquet_and_info_response.content["partial"] is partial
  
      upsert_response(
          "config-parquet-and-info",
          dataset=dataset,
          dataset_git_revision=REVISION_NAME,
          config=config,
          http_status=HTTPStatus.OK,
          content=parquet_and_info_response.content,
      )
  
      job_runner = get_job_runner(dataset, config, split, app_config)
      job_runner.pre_compute()
      if expected_error_code:
          with pytest.raises(Exception) as e:
              job_runner.compute()
          assert e.typename == expected_error_code
      else:
          response = job_runner.compute()
          assert sorted(response.content.keys()) == [
              "num_examples",
              "statistics",
          ]
          assert response.content["num_examples"] == expected_response["num_examples"]  # type: ignore
          response = response.content["statistics"]
          expected = expected_response["statistics"]  # type: ignore
          assert len(response) == len(expected)  # type: ignore
          assert set([column_response["column_name"] for column_response in response]) == set(  # type: ignore
              expected
          )  # assert returned feature names are as expected
  
          for column_response in response:  # type: ignore
              expected_column_response = expected[
                  column_response["column_name"]
              ]
              assert (
                  column_response["column_name"]
                  == expected_column_response["column_name"]
              )
              assert (
                  column_response["column_type"]
                  == expected_column_response["column_type"]
              )
              column_response_stats = column_response[
                  "column_statistics"
              ]
              expected_column_response_stats = expected_column_response[
                  "column_statistics"
              ]
              assert (
                  column_response_stats.keys()
                  == expected_column_response_stats.keys()
              )
              if column_response["column_type"] in [
                  ColumnType.FLOAT,
                  ColumnType.INT,
                  ColumnType.STRING_TEXT,
              ]:
                  hist, expected_hist = (
                      column_response_stats.pop("histogram"),
                      expected_column_response_stats.pop("histogram"),
                  )
                  assert hist["hist"] == expected_hist["hist"]
                  assert (
                      pytest.approx(hist["bin_edges"])
                      == expected_hist["bin_edges"]
                  )
                  assert (
                      column_response_stats["nan_count"]
                      == expected_column_response_stats["nan_count"]
                  )
                  assert (
                      pytest.approx(column_response_stats)
                      == expected_column_response_stats
                  )
                  if column_response["column_type"] is ColumnType.INT:
                      assert (
                          column_response_stats["min"]
                          == expected_column_response_stats["min"]
                      )
                      assert (
                          column_response_stats["max"]
                          == expected_column_response_stats["max"]
                      )
              elif column_response["column_type"] in [
                  ColumnType.STRING_LABEL,
                  ColumnType.CLASS_LABEL,
              ]:
                  assert (
                      column_response_stats
                      == expected_column_response_stats
                  )
              elif column_response["column_type"] is ColumnType.BOOL:
                  assert pytest.approx(
                      column_response_stats.pop("nan_proportion")
                  ) == expected_column_response_stats.pop(
                      "nan_proportion"
                  )
                  assert (
                      column_response_stats
                      == expected_column_response_stats
                  )
              else:
                  raise ValueError("Incorrect data type")
  
imports: import os
  from collections.abc import Callable, Mapping
  from dataclasses import replace
  from http import HTTPStatus
  from typing import Optional, Union
  import numpy
  import pandas
  import polars
  import pytest
  from datasets import ClassLabel, Dataset
  from libcommon.resources import CacheMongoResource, QueueMongoResource
  from libcommon.simple_cache import upsert_response
  from libcommon.storage import StrPath
  from libcommon.utils import Priority
  from worker.config import AppConfig
  from worker.job_runners.config.parquet_and_info import ConfigParquetAndInfoJobRunner
  from worker.job_runners.split.descriptive_statistics import DECIMALS, MAX_NUM_STRING_LABELS, NO_LABEL_VALUE, ColumnType, SplitDescriptiveStatisticsJobRunner, compute_bool_statistics, compute_class_label_statistics, compute_numerical_statistics, compute_string_statistics, generate_bins
  from worker.resources import LibrariesResource
  from ...fixtures.hub import HubDatasetTest
  from ..utils import REVISION_NAME
label_desc: Use image node_id 14 for calling a global function with example usage: test_compute(app_config, get_job_runner, get_parquet_and_info_job_runner, hub_responses_descriptive_statistics, hub_responses_descriptive_statistics_string_text, hub_responses_gated_descriptive_statistics, hub_responses_audio, hub_responses_big, hub_dataset_name, expected_error_code, descriptive_statistics_expected, descriptive_statistics_string_text_expected) without return types