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

Method test_no_array_function_like

numpy/core/tests/test_overrides.py:640–653  ·  view source on GitHub ↗
(self, function, args, kwargs, ref)

Source from the content-addressed store, hash-verified

638 @pytest.mark.parametrize('function, args, kwargs', _array_tests)
639 @pytest.mark.parametrize('ref', [1, [1], "MyNoArrayFunctionArray"])
640 def test_no_array_function_like(self, function, args, kwargs, ref):
641 self.add_method('array', self.MyNoArrayFunctionArray)
642 self.add_method(function, self.MyNoArrayFunctionArray)
643 np_func = getattr(np, function)
644
645 # Instantiate ref if it's the MyNoArrayFunctionArray class
646 if ref == "MyNoArrayFunctionArray":
647 ref = self.MyNoArrayFunctionArray.array()
648
649 like_args = tuple(a() if callable(a) else a for a in args)
650
651 with assert_raises_regex(TypeError,
652 'The `like` argument must be an array-like that implements'):
653 np_func(*like_args, **kwargs, like=ref)
654
655 @pytest.mark.parametrize('numpy_ref', [True, False])
656 def test_array_like_fromfile(self, numpy_ref):

Callers

nothing calls this directly

Calls 2

add_methodMethod · 0.95
assert_raises_regexFunction · 0.90

Tested by

no test coverage detected