code: def test_rolling_univariate(stat, func):
      def tail(iterable, n):
          return collections.deque(iterable, maxlen=n)
  
      n = stat.window_size
      X = [random.random() for _ in range(30)]
  
      for i, x in enumerate(X):
          stat.update(x)
          if i >= 1:
              assert math.isclose(
                  stat.get(), func(tail(X[: i + 1], n)), abs_tol=1e-10
              )
  
imports: from __future__ import annotations
  import collections
  import copy
  import functools
  import importlib
  import inspect
  import math
  import pickle
  import random
  import statistics
  import numpy
  import pytest
  from scipy import stats
  from river import stats, utils
label_desc: Use image node_id 8 for calling a global function with example usage: test_rolling_univariate(stat, func) and returns: collections