code: def test_fit_ndarray(time, sagemaker_session):
      mock_s3 = Mock()
      mock_object = Mock()
      mock_s3.Object = Mock(return_value=mock_object)
      sagemaker_session.boto_session.resource = Mock(
          return_value=mock_s3
      )
      kwargs = dict(COMMON_ARGS)
      kwargs["instance_count"] = 3
      pca = PCA(
          num_components=55,
          sagemaker_session=sagemaker_session,
          data_location="s3://{}/key-prefix/".format(BUCKET_NAME),
          **kwargs,
      )
      train = [
          [1.0, 2.0, 3.0],
          [4.0, 5.0, 6.0],
          [7.0, 8.0, 8.0],
          [44.0, 55.0, 66.0],
      ]
      labels = [99, 85, 87, 2]
      pca.fit(pca.record_set(np.array(train), np.array(labels)))
      mock_s3.Object.assert_any_call(
          BUCKET_NAME,
          "key-prefix/PCA-2017-11-06-14:14:15.671/matrix_0.pbr",
      )
      mock_s3.Object.assert_any_call(
          BUCKET_NAME,
          "key-prefix/PCA-2017-11-06-14:14:15.671/matrix_1.pbr",
      )
      mock_s3.Object.assert_any_call(
          BUCKET_NAME,
          "key-prefix/PCA-2017-11-06-14:14:15.671/matrix_2.pbr",
      )
      mock_s3.Object.assert_any_call(
          BUCKET_NAME,
          "key-prefix/PCA-2017-11-06-14:14:15.671/.amazon.manifest",
      )
  
      assert mock_object.put.call_count == 4
  
      called_args = sagemaker_session.train.call_args
      assert not called_args[1]["experiment_config"]
  
imports: from __future__ import absolute_import
  import numpy
  import pytest
  from mock import ANY, Mock, patch, call
  from sagemaker import image_uris
  from sagemaker.amazon.pca import PCA
  from sagemaker.amazon.amazon_estimator import upload_numpy_to_s3_shards, _build_shards, FileSystemRecordSet
  from sagemaker.session_settings import SessionSettings
  from tests.unit import DEFAULT_S3_OBJECT_KEY_PREFIX_NAME, DEFAULT_S3_BUCKET_NAME, _test_default_bucket_and_prefix_combinations
label_desc: Use image node_id 13 for calling a global function with example usage: test_fit_ndarray(time, sagemaker_session) without return types