class_docstr: Unit tests for the nearest neighbors builder class.
code: def test_add_samples_invalid_label_types(self):
      builder_int_labels = self.create_builder(default_class_label=42)
      self.assertIsNotNone(builder_int_labels)
  
      some_X = self.training_X[:3]
      invalid_int_y = [0, "one", 2]
      with self.assertRaises(TypeError):
          builder_int_labels.add_samples(some_X, invalid_int_y)
  
      builder_string_labels = self.create_builder(
          default_class_label="default"
      )
      self.assertIsNotNone(builder_string_labels)
  
      invalid_string_y = ["zero", "one", 2]
      with self.assertRaises(TypeError):
          builder_string_labels.add_samples(some_X, invalid_string_y)
  
imports: import os
  import shutil
  from coremltools.models.utils import _is_macos
  import unittest
  from coremltools.models import MLModel
  from coremltools.models.nearest_neighbors import KNearestNeighborsClassifierBuilder
  from coremltools._deps import _HAS_SKLEARN
label_desc: Use image node_id 18 for calling the NearestNeighborsBuilderTest obj's underlying member method code with example usage: obj.test_add_samples_invalid_label_types() without return types