code: def test_cache(self):
      table_name = "birth_names"
      payload = get_query_context(
          query_name=table_name,
          add_postprocessing_operations=True,
      )
      payload["force"] = True
  
      query_context = ChartDataQueryContextSchema().load(payload)
      query_object = query_context.queries[0]
      query_cache_key = query_context.query_cache_key(query_object)
  
      response = query_context.get_payload(cache_query_context=True)
      # MUST BE a successful query
      query_dump = response["queries"][0]
      assert query_dump["status"] == QueryStatus.SUCCESS
  
      cache_key = response["cache_key"]
      assert cache_key is not None
  
      cached = cache_manager.cache.get(cache_key)
      assert cached is not None
      assert "form_data" in cached["data"]
  
      rehydrated_qc = ChartDataQueryContextSchema().load(cached["data"])
      rehydrated_qo = rehydrated_qc.queries[0]
      rehydrated_query_cache_key = rehydrated_qc.query_cache_key(
          rehydrated_qo
      )
  
      self.assertEqual(
          rehydrated_qc.datasource, query_context.datasource
      )
      self.assertEqual(len(rehydrated_qc.queries), 1)
      self.assertEqual(query_cache_key, rehydrated_query_cache_key)
      self.assertEqual(
          rehydrated_qc.result_type, query_context.result_type
      )
      self.assertEqual(
          rehydrated_qc.result_format, query_context.result_format
      )
      self.assertFalse(rehydrated_qc.force)
  
imports: import re
  import time
  from typing import Any
  import numpy
  import pandas
  import pytest
  from pandas import DateOffset
  from superset import db
  from superset.charts.schemas import ChartDataQueryContextSchema
  from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
  from superset.common.query_context import QueryContext
  from superset.common.query_context_factory import QueryContextFactory
  from superset.common.query_object import QueryObject
  from superset.connectors.sqla.models import SqlMetric
  from superset.daos.datasource import DatasourceDAO
  from superset.extensions import cache_manager
  from superset.superset_typing import AdhocColumn
  from superset.utils.core import AdhocMetricExpressionType, backend, DatasourceType, QueryStatus
  from superset.utils.pandas_postprocessing.utils import FLAT_COLUMN_SEPARATOR
  from tests.integration_tests.base_tests import SupersetTestCase
  from tests.integration_tests.conftest import only_postgresql, only_sqlite
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  from tests.integration_tests.fixtures.query_context import get_query_context
label_desc: Use image node_id 2 for calling the TestQueryContext obj's underlying member method code with example usage: obj.test_cache() without return types