code: def setUp(self):
      self.client = unittest.mock.MagicMock()
  
      client._client_manager.clients["text"] = self.client
      client._client_manager.clients["model"] = self.client
  
      self.observed_requests = []
  
      self.responses = {}
  
      def add_client_method(f):
          name = f.__name__
          setattr(self.client, name, f)
          return f
  
      @add_client_method
      def generate_text(
          request: glm.GenerateTextRequest,
      ) -> glm.GenerateTextResponse:
          self.observed_requests.append(request)
          return self.responses["generate_text"]
  
      @add_client_method
      def embed_text(
          request: glm.EmbedTextRequest,
      ) -> glm.EmbedTextResponse:
          self.observed_requests.append(request)
          return self.responses["embed_text"]
  
      @add_client_method
      def batch_embed_text(
          request: glm.EmbedTextRequest,
      ) -> glm.EmbedTextResponse:
          self.observed_requests.append(request)
  
          return glm.BatchEmbedTextResponse(
              embeddings=[glm.Embedding(value=[1, 2, 3])]
              * len(request.texts)
          )
  
      @add_client_method
      def count_text_tokens(
          request: glm.CountTextTokensRequest,
      ) -> glm.CountTextTokensResponse:
          self.observed_requests.append(request)
          return self.responses["count_text_tokens"]
  
      @add_client_method
      def get_tuned_model(name) -> glm.TunedModel:
          request = glm.GetTunedModelRequest(name=name)
          self.observed_requests.append(request)
          response = copy.copy(self.responses["get_tuned_model"])
          return response
  
imports: import copy
  import math
  import unittest
  import unittest.mock
  import google.ai.generativelanguage
  from google.generativeai import text
  from google.generativeai import client
  from google.generativeai.types import safety_types
  from google.generativeai.types import model_types
  from absl.testing import absltest
  from absl.testing import parameterized
label_desc: Use image node_id 1 for calling the UnitTests obj's underlying member method code with example usage: obj.setUp() and returns: f, self, self, glm, self, response