class_docstr: Unit tests for the nearest neighbors builder class.
code: def test_can_init_and_save_model_from_builder_with_updated_spec(self):
      builder = KNearestNeighborsClassifierBuilder(
          input_name="input",
          output_name="output",
          number_of_dimensions=10,
          default_class_label="defaultLabel",
          k=3,
          weighting_scheme="inverse_distance",
          index_type="kd_tree",
          leaf_size=50,
      )
      builder.author = "CoreML Team"
      builder.license = "MIT"
      builder.description = "test_builder_with_validation"
  
      # Save the updated spec
      coreml_model = MLModel(builder.spec)
      self.assertIsNotNone(coreml_model)
      coreml_model_path = "/tmp/__test_builder_with_validation.mlmodel"
  
      try:
          coreml_model.save(coreml_model_path)
          self.assertTrue(os.path.isfile(coreml_model_path))
      finally:
          self._delete_mlmodel_and_mlmodelc(coreml_model_path)
  
imports: import os
  import shutil
  import unittest
  from coremltools._deps import _HAS_SKLEARN
  from coremltools.models import MLModel
  from coremltools.models.nearest_neighbors import KNearestNeighborsClassifierBuilder
  from coremltools.models.utils import _is_macos
label_desc: Use image node_id 19 for calling the NearestNeighborsBuilderTest obj's underlying member method code with example usage: obj.test_can_init_and_save_model_from_builder_with_updated_spec() without return types