code: def test_request_dict_with_tpu_worker(self):
      chief_config = machine_config.COMMON_MACHINE_CONFIGS["CPU"]
      worker_config = machine_config.COMMON_MACHINE_CONFIGS["TPU"]
      worker_count = 1
  
      _ = deploy.deploy_job(
          self.docker_img,
          chief_config,
          worker_count,
          worker_config,
          self.entry_point_args,
          self.stream_logs,
          service_account=self.service_account,
      )
      build_ret_val = self._mock_discovery_build.return_value
      proj_ret_val = build_ret_val.projects.return_value
      jobs_ret_val = proj_ret_val.jobs.return_value
  
      self.expected_request_dict["trainingInput"]["workerCount"] = "1"
      self.expected_request_dict["trainingInput"][
          "workerType"
      ] = "cloud_tpu"
      self.expected_request_dict["trainingInput"][
          "masterType"
      ] = "n1-standard-4"
      self.expected_request_dict["trainingInput"]["workerConfig"][
          "acceleratorConfig"
      ]["type"] = "TPU_V3"
      self.expected_request_dict["trainingInput"]["workerConfig"][
          "acceleratorConfig"
      ]["count"] = "8"
      self.expected_request_dict["trainingInput"]["workerConfig"][
          "tpuTfVersion"
      ] = "2.1"
      self.expected_request_dict["trainingInput"]["masterConfig"][
          "acceleratorConfig"
      ]["type"] = "ACCELERATOR_TYPE_UNSPECIFIED"
      self.expected_request_dict["trainingInput"]["masterConfig"][
          "acceleratorConfig"
      ]["count"] = "0"
  
      # Verify job creation args
      _, kwargs = jobs_ret_val.create.call_args
      self.assertDictEqual(
          kwargs,
          {
              "parent": "projects/" + self.mock_project_name,
              "body": self.expected_request_dict,
          },
      )
  
file_path: cloud/src/python/tensorflow_cloud/core/tests/unit/deploy_test.py
imports: import io
  from absl.testing import absltest
  from googleapiclient import discovery
  from googleapiclient import errors
  import mock
  from tensorflow_cloud.core import deploy
  from tensorflow_cloud.core import gcp
  from tensorflow_cloud.core import machine_config
  from tensorflow_cloud.utils import google_api_client
label_desc: Use image node_id 7 for calling the TestDeploy obj's underlying member method code with example usage: obj.test_request_dict_with_tpu_worker() without return types