| 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 |
no outgoing calls