class_docstr: Unit tests for the nearest neighbors builder class.
code: def test_set_number_of_neighbors_with_bounds_error_conditions(self):
      builder = self.create_builder()
      self.assertIsNotNone(builder)
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(3)
  
      test_range = (3, 15)
      test_set = {1, 3, 5}
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              3, allowed_range=test_range, allowed_set=test_set
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              3, allowed_range=(-5, 5)
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              3, allowed_range=(5, 1)
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              3, allowed_range=test_range, allowed_set=test_set
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              2, allowed_range=test_range
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              5, allowed_set={5, -3, 7}
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_set=test_set
          )
  
      with self.assertRaises(ValueError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_set=test_set
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              2, allowed_set=[1, 2, 3]
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_range={2, 200}
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_range=(2, 10, 20)
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_set=set()
          )
  
      with self.assertRaises(TypeError):
          builder.set_number_of_neighbors_with_bounds(
              4, allowed_range=[]
          )
  
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 13 for calling the NearestNeighborsBuilderTest obj's underlying member method code with example usage: obj.test_set_number_of_neighbors_with_bounds_error_conditions() without return types