MCPcopy Index your code
hub / github.com/numpy/numpy / test_like_as_none

Method test_like_as_none

numpy/_core/tests/test_overrides.py:752–768  ·  view source on GitHub ↗
(self, function, args, kwargs)

Source from the content-addressed store, hash-verified

750
751 @pytest.mark.parametrize('function, args, kwargs', _array_tests)
752 def test_like_as_none(self, function, args, kwargs):
753 MyArray = self._create_MyArray()
754 self.add_method('array', MyArray)
755 self.add_method(function, MyArray)
756 np_func = getattr(np, function)
757
758 like_args = tuple(a() if callable(a) else a for a in args)
759 # required for loadtxt and genfromtxt to init w/o error.
760 like_args_exp = tuple(a() if callable(a) else a for a in args)
761
762 array_like = np_func(*like_args, **kwargs, like=None)
763 expected = np_func(*like_args_exp, **kwargs)
764 # Special-case np.empty to ensure values match
765 if function == "empty":
766 array_like.fill(1)
767 expected.fill(1)
768 assert_equal(array_like, expected)
769
770
771def test_function_like():

Callers

nothing calls this directly

Calls 3

_create_MyArrayMethod · 0.95
add_methodMethod · 0.95
assert_equalFunction · 0.90

Tested by

no test coverage detected