code: def test_sub_cov(ddof):
      c1 = stats.Cov(ddof=ddof)
      c2 = stats.Cov(ddof=ddof)
  
      X = [random.random() for _ in range(30)]
      Y = [random.random() for _ in range(30)]
  
      for x, y in zip(X, Y):
          c1.update(x, y)
  
      for i, (x, y) in enumerate(zip(X, Y)):
          c2.update(x, y)
          if i < len(X) - 2:
              assert math.isclose(
                  (c1 - c2).get(),
                  np.cov(X[i + 1 :], Y[i + 1 :], ddof=ddof)[0, 1],
                  abs_tol=1e-10,
              )
  
      # Test inplace subtraction
      X.extend(random.random() for _ in range(3))
      Y.extend(random.random() for _ in range(3))
      for i in range(30, 33):
          c1.update(X[i], Y[i])
  
      c1 -= c2
      assert math.isclose(
          c1.get(),
          np.cov(X[30:33], Y[30:33], ddof=ddof)[0, 1],
          abs_tol=1e-10,
      )
  
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 7 for calling a global function with example usage: test_sub_cov(ddof) without return types