code: def test_moments_consistency_var_constant(
      consistent_data, rolling_consistency_cases, center, ddof
  ):
      window, min_periods = rolling_consistency_cases
  
      count_x = consistent_data.rolling(
          window=window, min_periods=min_periods, center=center
      ).count()
      var_x = consistent_data.rolling(
          window=window, min_periods=min_periods, center=center
      ).var(ddof=ddof)
  
      # check that variance of constant series is identically 0
      assert not (var_x > 0).any().any()
      expected = consistent_data * np.nan
      expected[count_x >= max(min_periods, 1)] = 0.0
      if ddof == 1:
          expected[count_x < 2] = np.nan
      tm.assert_equal(var_x, expected)
  
file_path: pandas/pandas/tests/window/moments/test_moments_consistency_rolling.py
imports: import numpy
  import pytest
  from pandas import Series
  import pandas._testing
label_desc: Use image node_id 6 for calling a global function with example usage: test_moments_consistency_var_constant(consistent_data, rolling_consistency_cases, center, ddof) without return types