code: def test_multiblock_ref():
      # can't use fixtures here as we need to remove all references for
      # garbage collection
      sphere = pv.Sphere()
      cube = pv.Cube()
  
      block = MultiBlock([sphere, cube])
      block[0]["a_new_var"] = np.zeros(block[0].n_points)
      assert "a_new_var" in block[0].array_names
  
      assert sphere is block[0]
      assert cube is block[1]
  
      wref_sphere = weakref.ref(sphere)
      wref_cube = weakref.ref(cube)
  
      # verify reference remains
      assert wref_sphere() is sphere
      del sphere
      assert wref_sphere() is not None
  
      # verify __delitem__ works and removes reference
      del block[0]
      assert wref_sphere() is None
  
      # verify reference remains
      assert wref_cube() is cube
  
      # verify the __setitem__(index, None) edge case
      del cube
      block[0] = None
      assert wref_cube() is None
  
imports: import pathlib
  import platform
  import weakref
  import numpy
  import pytest
  import vtk
  import pyvista
  from pyvista import ImageData, MultiBlock, PolyData, RectilinearGrid, StructuredGrid, examples
label_desc: Use image node_id 33 for calling a global function with example usage: test_multiblock_ref() without return types