code: def test_wrong_token_label_format():
      # Arrange
      tokenized_text = [["a"], ["b", "b", "b"], ["c", "c", "c", "c"]]
  
      label_structure_error = r"label must be a Sequence of Sequences of either strings or integers"
  
      # Act & Assert
      # OK sample:
      label = [
          ["B-PER"],
          ["B-PER", "B-GEO", "B-GEO"],
          ["B-PER", "B-GEO", "B-GEO", "B-GEO"],
      ]
      _ = TextData(
          tokenized_text=tokenized_text,
          label=label,
          task_type="token_classification",
      )  # Should pass
  
      # Not a list:
      label = "PER"
      assert_that(
          calling(TextData).with_args(
              tokenized_text=tokenized_text,
              label=label,
              task_type="token_classification",
          ),
          raises(DeepchecksValueError, "label must be a Sequence"),
      )
  
      # Not a list of lists:
      label = [3, 3, 3]
      assert_that(
          calling(TextData).with_args(
              tokenized_text=tokenized_text,
              label=label,
              task_type="token_classification",
          ),
          raises(DeepchecksValueError, label_structure_error),
      )
  
      # Mixed strings and integers:
      label = [["B-PER"], 1, ["B-PER", "B-GEO", "B-GEO", "B-GEO"]]
      assert_that(
          calling(TextData).with_args(
              tokenized_text=tokenized_text,
              label=label,
              task_type="token_classification",
          ),
          raises(DeepchecksValueError, label_structure_error),
      )
  
      # Not of same length:
      label = [
          ["B-PER"],
          ["B-PER", "B-GEO", "B-GEO"],
          ["B-PER", "B-GEO", "B-GEO"],
      ]
      assert_that(
          calling(TextData).with_args(
              tokenized_text=tokenized_text,
              label=label,
              task_type="token_classification",
          ),
          raises(
              DeepchecksValueError,
              r"label must be the same length as tokenized_text. However, for sample "
              r"index 2 received token list of length 4 and label list of length 3",
          ),
      )
  
imports: import numpy
  import pandas
  from hamcrest import assert_that, calling, contains_exactly, equal_to, raises
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.nlp.text_data import TextData
label_desc: Use image node_id 5 for calling a global function with example usage: test_wrong_token_label_format() without return types