code: def test_nans(raw):
      obj = Series(np.random.default_rng(2).standard_normal(50))
      obj[:10] = np.nan
      obj[-10:] = np.nan
  
      result = obj.rolling(50, min_periods=30).apply(f, raw=raw)
      tm.assert_almost_equal(result.iloc[-1], np.mean(obj[10:-10]))
  
      # min_periods is working correctly
      result = obj.rolling(20, min_periods=15).apply(f, raw=raw)
      assert isna(result.iloc[23])
      assert not isna(result.iloc[24])
  
      assert not isna(result.iloc[-6])
      assert isna(result.iloc[-5])
  
      obj2 = Series(np.random.default_rng(2).standard_normal(20))
      result = obj2.rolling(10, min_periods=5).apply(f, raw=raw)
      assert isna(result.iloc[3])
      assert notna(result.iloc[4])
  
      result0 = obj.rolling(20, min_periods=0).apply(f, raw=raw)
      result1 = obj.rolling(20, min_periods=1).apply(f, raw=raw)
      tm.assert_almost_equal(result0, result1)
  
imports: import numpy
  import pytest
  from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, concat, date_range, isna, notna
  import pandas._testing
  from pandas.tseries import offsets
label_desc: Use image node_id 12 for calling a global function with example usage: test_nans(raw) without return types