code: def test_ewm_methods(
      s: pl.Series,
      com: float | None,
      span: float | None,
      half_life: float | None,
      ignore_nulls: bool,
      adjust: bool,
      bias: bool,
  ) -> None:
      # validate a large set of varied EWM calculations
      for decay_param in [
          {"com": com},
          {"span": span},
          {"half_life": half_life},
      ]:
          alpha = _prepare_alpha(**decay_param)
  
          # convert parametrically-generated series to pandas, then use that as a
          # reference implementation for comparison (after normalising NaN/None)
          p = s.to_pandas()
  
          # note: skip min_periods < 2, due to pandas-side inconsistency:
          # https://github.com/pola-rs/polars/issues/5006#issuecomment-1259477178
          for mp in range(2, len(s), len(s) // 3):
              # consolidate ewm parameters
              pl_params: dict[str, Any] = {
                  "min_periods": mp,
                  "adjust": adjust,
                  "ignore_nulls": ignore_nulls,
              }
              pl_params.update(decay_param)
              pd_params = pl_params.copy()
              if "half_life" in pl_params:
                  pd_params["halflife"] = pd_params.pop("half_life")
              if "ignore_nulls" in pl_params:
                  pd_params["ignore_na"] = pd_params.pop("ignore_nulls")
  
              # mean:
              ewm_mean_pl = s.ewm_mean(**pl_params).fill_nan(None)
              ewm_mean_pd = pl.Series(p.ewm(**pd_params).mean())
              if alpha == 1:
                  # apply fill-forward to nulls to match pandas
                  # https://github.com/pola-rs/polars/pull/5011#issuecomment-1262318124
                  ewm_mean_pl = ewm_mean_pl.fill_null(
                      strategy="forward"
                  )
  
              assert_series_equal(ewm_mean_pl, ewm_mean_pd, atol=1e-07)
  
              # std:
              ewm_std_pl = s.ewm_std(bias=bias, **pl_params).fill_nan(
                  None
              )
              ewm_std_pd = pl.Series(p.ewm(**pd_params).std(bias=bias))
              assert_series_equal(ewm_std_pl, ewm_std_pd, atol=1e-07)
  
              # var:
              ewm_var_pl = s.ewm_var(bias=bias, **pl_params).fill_nan(
                  None
              )
              ewm_var_pd = pl.Series(p.ewm(**pd_params).var(bias=bias))
              assert_series_equal(ewm_var_pl, ewm_var_pd, atol=1e-07)
  
file_path: polars/py-polars/tests/parametric/test_series.py
imports: from __future__ import annotations
  from typing import Any
  from hypothesis import given, settings
  from hypothesis.strategies import booleans, floats, sampled_from
  import polars
  from polars.expr.expr import _prepare_alpha
  from polars.testing import assert_series_equal
  from polars.testing.parametric import series
label_desc: Use image node_id 2 for calling a global function with example usage: test_ewm_methods(s, com, span, half_life, ignore_nulls, adjust, bias) without return types