class_docstr: Unit test for Smart Data Lake Code Generator
class_docstr_tok: ["Unit","test","for","Smart","Data","Lake","Code","Generator"]
code: def test_code_not_found_in_cache(self, context, logger):
      # Test Flow : Code Not found in the cache
      code_generator = CodeGenerator()
  
      mock_get_promt = Mock(return_value=GeneratePythonCodePrompt)
  
      def mock_intermediate_values(key: str):
          if key == "output_type_helper":
              return output_type_factory("DefaultOutputType")
          elif key == "viz_lib_helper":
              return viz_lib_type_factory("DefaultVizLibraryType")
          elif key == "get_prompt":
              return mock_get_promt
  
      def mock_execute_func(function, *args, **kwargs):
          if function == mock_get_promt:
              return mock_get_promt()
          return "Mocked LLM Generated Code"
  
      context.get_intermediate_value = Mock(
          side_effect=mock_intermediate_values
      )
      context._cache = Mock()
      context.cache.get = Mock(return_value=None)
      context._query_exec_tracker = Mock()
      context.query_exec_tracker.execute_func = Mock(
          side_effect=mock_execute_func
      )
  
      code = code_generator.execute(
          input=None, context=context, logger=logger
      )
  
      assert isinstance(code_generator, CodeGenerator)
      assert code == "Mocked LLM Generated Code"
  
imports: from typing import Optional
  from unittest.mock import Mock
  import pandas
  import pytest
  from pandasai.helpers.logger import Logger
  from pandasai.helpers.output_types import output_type_factory
  from pandasai.helpers.viz_library_types import viz_lib_type_factory
  from pandasai.llm.fake import FakeLLM
  from pandasai.pipelines.pipeline_context import PipelineContext
  from pandasai.prompts.generate_python_code import GeneratePythonCodePrompt
  from pandasai.smart_dataframe import SmartDataframe
  from pandasai.pipelines.smart_datalake_chat.code_generator import CodeGenerator
label_desc: Use image node_id 8 for calling the TestCodeGenerator obj's underlying member method code with example usage: obj.test_code_not_found_in_cache(context, logger) and returns: str, output_type_factory, mock_get_promt, viz_lib_type_factory, mock_get_promt