code: def test_add_mean():
      A = stats.Mean()
      B = stats.Mean()
      C = stats.Mean()
  
      X = [random.random() for _ in range(30)]
      Y = [random.random() for _ in range(30)]
      W = [random.random() for _ in range(30)]
  
      for i, (x, y, w) in enumerate(zip(X, Y, W)):
          A.update(x, w)
          B.update(y, w)
          C.update(x, w)
          C.update(y, w)
  
          D = A + B
          assert math.isclose(C.get(), D.get())
  
          # TODO: clone should work instead of deepcopy
          E = copy.deepcopy(A)
          E += B
          assert math.isclose(C.get(), E.get())
  
          assert math.isclose(
              C.get(),
              np.average(
                  X[: i + 1] + Y[: i + 1],
                  weights=W[: i + 1] + W[: i + 1],
              ),
          )
  
file_path: river/river/stats/test_parallel.py
imports: from __future__ import annotations
  import copy
  import math
  import random
  import numpy
  import pytest
  from river import stats
label_desc: Use image node_id 1 for calling a global function with example usage: test_add_mean() without return types