code: def test_modifying_modifies_dataset():
      dataset = examples.load_structured()
      points = pyvista_ndarray(
          dataset.GetPoints().GetData(), dataset=dataset
      )
  
      dataset_modified = mock.Mock()
      array_modified = mock.Mock()
      dataset.AddObserver(
          _vtk.vtkCommand.ModifiedEvent, dataset_modified
      )
      points.AddObserver(_vtk.vtkCommand.ModifiedEvent, array_modified)
  
      # __setitem__ calls dataset.Modified() and points.Modified()
      points[:] *= 0.5
      assert dataset_modified.call_count == 1
      assert array_modified.call_count == 1
  
      # __setitem__ with single-indices works does same
      points[0, 0] = 0.5
      assert dataset_modified.call_count == 2
      assert array_modified.call_count == 2
  
      # setting all new points calls dataset.Modified()
      dataset.points = points.copy()
      assert dataset_modified.call_count == 3
      assert array_modified.call_count == 2
  
file_path: pyvista/tests/core/test_pyvista_ndarray.py
imports: from unittest import mock
  import numpy
  import pytest
  import vtk
  from pyvista import examples, pyvista_ndarray
label_desc: Use image node_id 4 for calling a global function with example usage: test_modifying_modifies_dataset() without return types