code: def test_classlabel_init(tmp_path_factory):
      names = ["negative", "positive"]
      names_file = str(
          tmp_path_factory.mktemp("features") / "labels.txt"
      )
      with open(names_file, "w", encoding="utf-8") as f:
          f.write("\n".join(names))
      classlabel = ClassLabel(names=names)
      assert (
          classlabel.names == names
          and classlabel.num_classes == len(names)
      )
      classlabel = ClassLabel(names_file=names_file)
      assert (
          classlabel.names == names
          and classlabel.num_classes == len(names)
      )
      classlabel = ClassLabel(num_classes=len(names), names=names)
      assert (
          classlabel.names == names
          and classlabel.num_classes == len(names)
      )
      classlabel = ClassLabel(num_classes=len(names))
      assert classlabel.names == [
          str(i) for i in range(len(names))
      ] and classlabel.num_classes == len(names)
      with pytest.raises(ValueError):
          classlabel = ClassLabel(
              num_classes=len(names) + 1, names=names
          )
      with pytest.raises(ValueError):
          classlabel = ClassLabel(names=names, names_file=names_file)
      with pytest.raises(ValueError):
          classlabel = ClassLabel()
      with pytest.raises(TypeError):
          classlabel = ClassLabel(names=np.array(names))
  
imports: import datetime
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  import pandas
  import pyarrow
  import pytest
  from datasets import Array2D
  from datasets.arrow_dataset import Dataset
  from datasets.features import Audio, ClassLabel, Features, Image, Sequence, Value
  from datasets.features.features import _arrow_to_datasets_dtype, _cast_to_python_objects, cast_to_python_objects, encode_nested_example, generate_from_dict, string_to_arrow
  from datasets.features.translation import Translation, TranslationVariableLanguages
  from datasets.info import DatasetInfo
  from datasets.utils.py_utils import asdict
  from ..utils import require_jax, require_tf, require_torch
label_desc: Use image node_id 1 for calling a global function with example usage: test_classlabel_init(tmp_path_factory) without return types