code: def test_add(n):
      elements = get_elements(n)
      dis1 = DisjointSet(elements)
  
      dis2 = DisjointSet()
      for i, x in enumerate(elements):
          dis2.add(x)
          assert len(dis2) == i + 1
  
          # test idempotency by adding element again
          dis2.add(x)
          assert len(dis2) == i + 1
  
      assert list(dis1) == list(dis2)
  
file_path: scipy/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 6 for calling a global function with example usage: test_add(n) without return types