MCPcopy Create free account
hub / github.com/numpy/numpy / ArrayProxy

Class ArrayProxy

numpy/core/tests/test_overrides.py:509–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507 # We need a proxy for mocks because __array_function__ is only looked
508 # up in the class dict
509 class ArrayProxy:
510 def __init__(self, value):
511 self.value = value
512 def __array_function__(self, *args, **kwargs):
513 return self.value.__array_function__(*args, **kwargs)
514 def __array__(self, *args, **kwargs):
515 return self.value.__array__(*args, **kwargs)
516
517 proxy = ArrayProxy(mock.Mock(spec=ArrayProxy))
518 proxy.value.__array_function__.return_value = 1

Callers 1

Calls

no outgoing calls

Tested by 1