code: def test_subsets(n):
      elements = get_elements(n)
      dis = DisjointSet(elements)
  
      rng = np.random.RandomState(seed=0)
      for i, j in rng.randint(0, n, (n, 2)):
          x = elements[i]
          y = elements[j]
  
          expected = {
              element for element in dis if {dis[element]} == {dis[x]}
          }
          assert expected == dis.subset(x)
  
          expected = {dis[element]: set() for element in dis}
          for element in dis:
              expected[dis[element]].add(element)
          expected = list(expected.values())
          assert expected == dis.subsets()
  
          dis.merge(x, y)
          assert dis.subset(x) == dis.subset(y)
  
file_path: catboost/contrib/python/scipy/py3/scipy/cluster/tests/test_disjoint_set.py
imports: import pytest
  from pytest import raises
  import numpy
  from scipy.cluster.hierarchy import DisjointSet
  import string
label_desc: Use image node_id 12 for calling a global function with example usage: test_subsets(n) without return types