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

Method test_like_as_none

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

Source from the content-addressed store, hash-verified

689
690 @pytest.mark.parametrize('function, args, kwargs', _array_tests)
691 def test_like_as_none(self, function, args, kwargs):
692 self.add_method('array', self.MyArray)
693 self.add_method(function, self.MyArray)
694 np_func = getattr(np, function)
695
696 like_args = tuple(a() if callable(a) else a for a in args)
697 # required for loadtxt and genfromtxt to init w/o error.
698 like_args_exp = tuple(a() if callable(a) else a for a in args)
699
700 array_like = np_func(*like_args, **kwargs, like=None)
701 expected = np_func(*like_args_exp, **kwargs)
702 # Special-case np.empty to ensure values match
703 if function == "empty":
704 array_like.fill(1)
705 expected.fill(1)
706 assert_equal(array_like, expected)
707
708
709def test_function_like():

Callers

nothing calls this directly

Calls 2

add_methodMethod · 0.95
assert_equalFunction · 0.90

Tested by

no test coverage detected