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

Method test_0d

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

Source from the content-addressed store, hash-verified

2666 assert_array_equal(x, [2, 3])
2667
2668 def test_0d(self):
2669 x = np.array(3)
2670 y = piecewise(x, x > 3, [4, 0])
2671 assert_(y.ndim == 0)
2672 assert_(y == 0)
2673
2674 x = 5
2675 y = piecewise(x, [True, False], [1, 0])
2676 assert_(y.ndim == 0)
2677 assert_(y == 1)
2678
2679 # With 3 ranges (It was failing, before)
2680 y = piecewise(x, [False, False, True], [1, 2, 3])
2681 assert_array_equal(y, 3)
2682
2683 def test_0d_comparison(self):
2684 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