code: def test_sum_on_mock_array(self):
      # We need a proxy for mocks because __array_function__ is only looked
      # up in the class dict
      class ArrayProxy:
          def __init__(self, value):
              self.value = value
  
          def __array_function__(self, *args, **kwargs):
              return self.value.__array_function__(*args, **kwargs)
  
          def __array__(self, *args, **kwargs):
              return self.value.__array__(*args, **kwargs)
  
      proxy = ArrayProxy(mock.Mock(spec=ArrayProxy))
      proxy.value.__array_function__.return_value = 1
      result = np.sum(proxy)
      assert_equal(result, 1)
      proxy.value.__array_function__.assert_called_once_with(
          np.sum, (ArrayProxy,), (proxy,), {}
      )
      proxy.value.__array__.assert_not_called()
  
imports: import inspect
  import sys
  import os
  import tempfile
  from io import StringIO
  from unittest import mock
  import numpy
  from numpy.testing import assert_, assert_equal, assert_raises, assert_raises_regex
  from numpy.core.overrides import _get_implementing_args, array_function_dispatch, verify_matching_signatures
  from numpy.compat import pickle
  import pytest
label_desc: Use image node_id 4 for calling the TestNumPyFunctions obj's underlying member method code with example usage: obj.test_sum_on_mock_array() and returns: self, self