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

Method test_0d

numpy/lib/tests/test_function_base.py:2931–2944  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2929 assert_array_equal(x, [2, 3])
2930
2931 def test_0d(self):
2932 x = np.array(3)
2933 y = piecewise(x, x > 3, [4, 0])
2934 assert_(y.ndim == 0)
2935 assert_(y == 0)
2936
2937 x = 5
2938 y = piecewise(x, [True, False], [1, 0])
2939 assert_(y.ndim == 0)
2940 assert_(y == 1)
2941
2942 # With 3 ranges (It was failing, before)
2943 y = piecewise(x, [False, False, True], [1, 2, 3])
2944 assert_array_equal(y, 3)
2945
2946 def test_0d_comparison(self):
2947 x = 3

Callers

nothing calls this directly

Calls 3

piecewiseFunction · 0.90
assert_Function · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected