code: def test_duration_extract_times_deprecated_methods(
      unit_attr: str,
      expected: pl.Series,
  ) -> None:
      duration = pl.Series([datetime(2022, 1, 2)]) - pl.Series(
          [datetime(2022, 1, 1)]
      )
  
      with pytest.deprecated_call():
          assert_series_equal(
              getattr(duration.dt, unit_attr)(), expected
          )
      with pytest.deprecated_call():
          # Test Expr case too
          result_df = pl.select(
              getattr(pl.lit(duration).dt, unit_attr)()
          )
          assert_series_equal(result_df[result_df.columns[0]], expected)
  
imports: from __future__ import annotations
  import sys
  from datetime import date, datetime, time, timedelta
  from typing import TYPE_CHECKING
  import pytest
  import polars
  from polars.datatypes import DTYPE_TEMPORAL_UNITS
  from polars.dependencies import _ZONEINFO_AVAILABLE
  from polars.exceptions import ComputeError, InvalidOperationError
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 26 for calling a global function with example usage: test_duration_extract_times_deprecated_methods(unit_attr, expected) without return types