code: def run2():
      t = CustomObjectStore(1)
      t_ref_count = 2
      assert sys.getrefcount(t) == t_ref_count
  
      indexes = set([0])
  
      tbl = Table({"a": [0], "b": [t]}, index="a")
      assert sys.getrefcount(t) == 3
      t_ref_count += 1
  
      assert tbl.schema() == {"a": int, "b": object}
      assert tbl.size() == 1
      assert tbl.view().to_dict() == {"a": [0], "b": [t]}
  
      # seed a few to check
      tbl.remove([1])
      tbl.remove([1])
      tbl.remove([1])
  
      for _ in range(10):
          pick = randint(1, 2) if indexes else 1
          if pick == 1:
              ind = randint(1, 10)
              while ind in indexes:
                  ind = randint(1, 100)
  
              print(
                  "adding",
                  ind,
                  "refcount",
                  t_ref_count,
                  "should be",
                  sys.getrefcount(t),
              )
              tbl.update({"a": [ind], "b": [t]})
              t_ref_count += 1
              indexes.add(ind)
              assert sys.getrefcount(t) == t_ref_count
  
          else:
              ind = choice(list(indexes))
              indexes.remove(ind)
              tbl.remove([ind])
              t_ref_count -= 1
              print(
                  "removing",
                  ind,
                  "refcount",
                  t_ref_count,
                  "should be",
                  sys.getrefcount(t),
              )
              assert sys.getrefcount(t) == t_ref_count
  
          print(t_ref_count)
          print(tbl.view().to_dict())
  
      assert sys.getrefcount(t) == t_ref_count
  
      print()
      tbl.clear()
      assert tbl.size() == 0
      assert tbl.view().to_dict() == {}
      # 1 for `t`, one for `data`, one for argument to sys.getrefcount
      print(sys.getrefcount(t), "should be", 2)
      assert sys.getrefcount(t) == 2
  
file_path: perspective/python/perspective/perspective/tests/table/object_sequence.py
imports: import sys
  from random import randint, choice
  from perspective.table import Table
label_desc: Use image node_id 2 for calling a global function with example usage: run2() without return types