code: def test_default_k_and_model_get_ood_features_scores():
      # Testing using 'None' as model param and correct setting of default k as max_k
  
      # Create dataset with OOD example
      X = data["X_test"]
      X_ood = np.array([[999999999.0, 999999999.0]])
      X_with_ood = np.vstack([X, X_ood])
  
      instantiated_k = 10
  
      # Create NN class object with small instantiated k and fit on data
      knn = NearestNeighbors(
          n_neighbors=instantiated_k, metric="euclidean"
      ).fit(X_with_ood)
  
      (
          avg_knn_distances_default_model,
          _,
      ) = outlier._get_ood_features_scores(
          features=X_with_ood,
          k=instantiated_k,  # this should use default estimator (same as above) and k = instantiated_k
      )
  
      (
          avg_knn_distances_default_k,
          knn2,
      ) = outlier._get_ood_features_scores(
          features=X_with_ood,  # default k should be set to 10 == instantiated_k
      )
      assert isinstance(knn2, type(knn))
  
      avg_knn_distances, _ = outlier._get_ood_features_scores(
          features=None,
          knn=knn,
          k=25,  # this should throw user warn, k should be set to instantiated_k
      )
  
      # Score sums should be equal because the three estimators used have identical params and fit
      assert (
          avg_knn_distances.sum()
          == avg_knn_distances_default_model.sum()
      )
      assert (
          avg_knn_distances_default_k.sum() == avg_knn_distances.sum()
      )
  
      avg_knn_distances_large_k, _ = outlier._get_ood_features_scores(
          features=X_with_ood,
          k=25,  # this should use default estimator and k = 25
      )
  
      avg_knn_distances_tiny_k, _ = outlier._get_ood_features_scores(
          features=None,
          knn=knn,
          k=1,  # this should use knn estimator and k = 1
      )
  
      (
          avg_knn_distances_tiny_k_default,
          _,
      ) = outlier._get_ood_features_scores(
          features=X_with_ood,
          k=1,  # this should use default estimator and k = 1
      )
  
      # Score sums should be different because k = user param for estimators and k != 10.
      assert avg_knn_distances_tiny_k.sum() != avg_knn_distances.sum()
      assert avg_knn_distances_large_k.sum() != avg_knn_distances.sum()
      assert (
          avg_knn_distances_tiny_k_default.sum()
          != avg_knn_distances_default_model.sum()
      )
  
      # Test that when knn is None ValueError raised if passed in k > len(features)
      try:
          outlier._get_ood_features_scores(
              features=X_with_ood,
              knn=None,
              k=len(X_with_ood)
              + 1,  # this should throw ValueError, k ! > len(features)
          )
      except Exception as e:
          assert "nearest neighbors" in str(e)
          with pytest.raises(ValueError) as e:
              outlier._get_ood_features_scores(
                  features=X_with_ood,
                  knn=None,
                  k=len(X_with_ood)
                  + 1,  # this should throw ValueError, k ! > len(features)
              )
  
imports: import numpy
  import pandas
  import pytest
  from cleanlab.benchmarking.noise_generation import generate_noise_matrix_from_trace
  from cleanlab.benchmarking.noise_generation import generate_noisy_labels
  from cleanlab import count, outlier
  from cleanlab.count import get_confident_thresholds
  from cleanlab.outlier import OutOfDistribution
  from cleanlab.internal.label_quality_utils import get_normalized_entropy
  from sklearn.neighbors import NearestNeighbors
  from sklearn.linear_model import LogisticRegression
label_desc: Use image node_id 7 for calling a global function with example usage: test_default_k_and_model_get_ood_features_scores() without return types