class_docstr: Test the angle generation utility functions.
class_docstr_tok: ["Test","the","angle","generation","utility","functions","."]
docstr: Test get_angles when caching is enabled.
docstr_tok: ["Test","get_angles","when","caching","is","enabled","."]
code: def test_cache_get_angles(
      self,
      input_func,
      num_normalized_chunks,
      exp_zarr_chunks,
      input2_func,
      exp_equal_sun,
      exp_num_zarr,
      force_bad_glob,
      tmp_path,
  ):
      """Test get_angles when caching is enabled."""
      from satpy.modifiers.angles import (
          STATIC_EARTH_INERTIAL_DATETIME,
          get_angles,
      )
  
      # Patch methods
      data = input_func()
      additional_cache = exp_num_zarr > 4
  
      # Compute angles
      from pyorbital.orbital import get_observer_look
  
      with mock.patch(
          "satpy.modifiers.angles.get_observer_look",
          wraps=get_observer_look,
      ) as gol, satpy.config.set(
          cache_lonlats=True,
          cache_sensor_angles=True,
          cache_dir=str(tmp_path),
      ), warnings.catch_warnings(
          record=True
      ) as caught_warnings:
          res = get_angles(data)
          self._check_cached_result(res, exp_zarr_chunks)
  
          # call again, should be cached
          new_data = input2_func(data)
          with _mock_glob_if(force_bad_glob):
              res2 = get_angles(new_data)
          self._check_cached_result(res2, exp_zarr_chunks)
  
          res_numpy, res2_numpy = da.compute(res, res2)
          for r1, r2 in zip(res_numpy[:2], res2_numpy[:2]):
              _assert_allclose_if(not additional_cache, r1, r2)
          for r1, r2 in zip(res_numpy[2:], res2_numpy[2:]):
              _assert_allclose_if(exp_equal_sun, r1, r2)
  
          self._check_cache_and_clear(tmp_path, exp_num_zarr)
  
      if "odd_chunks" in input_func.__name__:
          assert any(
              w.category is PerformanceWarning for w in caught_warnings
          )
      else:
          assert not any(
              w.category is PerformanceWarning for w in caught_warnings
          )
      assert gol.call_count == num_normalized_chunks * (
          int(additional_cache) + 1
      )
      args = gol.call_args_list[0][0]
      assert args[:4] == (
          10.0,
          0.0,
          12345.678,
          STATIC_EARTH_INERTIAL_DATETIME,
      )
      exp_sat_lon = 10.1 if additional_cache else 10.0
      args = gol.call_args_list[-1][0]
      assert args[:4] == (
          exp_sat_lon,
          0.0,
          12345.678,
          STATIC_EARTH_INERTIAL_DATETIME,
      )
  
imports: import contextlib
  import warnings
  from copy import deepcopy
  from datetime import datetime, timedelta
  from glob import glob
  from typing import Optional, Union
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from pyresample.geometry import AreaDefinition, StackedAreaDefinition
  import satpy
  from satpy.utils import PerformanceWarning
label_desc: Use image node_id 3 for calling the TestAngleGeneration obj's underlying member method code with example usage: obj.test_cache_get_angles(input_func, num_normalized_chunks, exp_zarr_chunks, input2_func, exp_equal_sun, exp_num_zarr, force_bad_glob, tmp_path) without return types