code: def test_pca_validation(setup):
      for solver in solver_list:
          # Ensures that solver-specific extreme inputs for the n_components
          # parameter raise errors
          X = mt.array([[0, 1, 0], [1, 0, 0]])
          smallest_d = 2  # The smallest dimension
          lower_limit = {"randomized": 1, "full": 0, "auto": 0}
  
          # We conduct the same test on X.T so that it is invariant to axis.
          for data in [X, X.T]:
              for n_components in [-1, 3]:
                  if solver == "auto":
                      solver_reported = "full"
                  else:
                      solver_reported = solver
  
                  assert_raises_regex(
                      ValueError,
                      f"n_components={n_components}L? must be between "
                      rf"{lower_limit[solver]}L? and min\(n_samples, n_features\)="
                      f"{smallest_d}L? with svd_solver='{solver_reported}'",
                      PCA(n_components, svd_solver=solver).fit,
                      data,
                  )
  
          n_components = 1.0
          type_ncom = type(n_components)
          assert_raise_message(
              ValueError,
              f"n_components={n_components} must be of type int "
              f"when greater than or equal to 1, was of type={type_ncom}",
              PCA(n_components, svd_solver=solver).fit,
              data,
          )
  
imports: from itertools import product
  import numpy
  import pytest
  import scipy
  from sklearn import datasets
  from sklearn.utils._testing import assert_array_almost_equal, assert_almost_equal, assert_raises_regex, assert_raise_message, assert_raises
  from ....None import tensor
  from .._pca import PCA, _assess_dimension, _infer_dimension
label_desc: Use image node_id 8 for calling a global function with example usage: test_pca_validation(setup) without return types