code: def test_classlabel_cast_storage():
      names = ["negative", "positive"]
      classlabel = ClassLabel(names=names)
      # from integers
      arr = pa.array([0, 1, -1, -100], type=pa.int64())
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == [0, 1, -1, -100]
      arr = pa.array([0, 1, -1, -100], type=pa.int32())
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == [0, 1, -1, -100]
      arr = pa.array([3])
      with pytest.raises(ValueError):
          classlabel.cast_storage(arr)
      # from strings
      arr = pa.array(["negative", "positive"])
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == [0, 1]
      arr = pa.array(["__label_that_doesnt_exist__"])
      with pytest.raises(ValueError):
          classlabel.cast_storage(arr)
      # from nulls
      arr = pa.array([None])
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == [None]
      # from empty
      arr = pa.array([], pa.int64())
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == []
      arr = pa.array([], pa.string())
      result = classlabel.cast_storage(arr)
      assert result.type == pa.int64()
      assert result.to_pylist() == []
  
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 4 for calling a global function with example usage: test_classlabel_cast_storage() without return types