code: def test_cluster_formation_and_cleanup():
      dbstream = build_dbstream()
  
      X = [
          {1: 1},
          {1: 2},
          {1: 3},
          {1: 3},
          {1: 3},
          {1: 5},
          {1: 7},
          {1: 9},
          {1: 10},
          {1: 11},
          {1: 11},
          {1: 12},
          {1: 13},
          {1: 11},
          {1: 15},
          {1: 15},
          {1: 16},
          {1: 17},
          {1: 17},
          {1: 17},
      ]
  
      for x in X:
          dbstream.learn_one(x)
  
      assert len(dbstream._micro_clusters) == 4
      assert_micro_cluster_properties(
          dbstream.micro_clusters[2], center={1: 3}, last_update=4
      )
      assert_micro_cluster_properties(
          dbstream.micro_clusters[7], center={1: 11}, last_update=13
      )
      assert_micro_cluster_properties(
          dbstream.micro_clusters[8], center={1: 15}, last_update=15
      )
      assert_micro_cluster_properties(
          dbstream.micro_clusters[10], center={1: 17}, last_update=19
      )
  
      assert dbstream.predict_one({1: 2.0}) == 0
      assert dbstream.predict_one({1: 13.0}) == 1
      assert dbstream.predict_one({1: 13 + 1e-10}) == 2
      assert dbstream.predict_one({1: 16 - 1e-10}) == 2
      assert dbstream.predict_one({1: 18}) == 3
  
      assert len(dbstream._clusters) == 4
      assert dbstream.s == dbstream.s_t == {}
  
file_path: river/river/cluster/test_dbstream.py
imports: from __future__ import annotations
  import pytest
  from sklearn.datasets import make_blobs
  from river import metrics, stream, utils
  from river.cluster import DBSTREAM
label_desc: Use image node_id 4 for calling a global function with example usage: test_cluster_formation_and_cleanup() without return types