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

Method test_errors

numpy/lib/tests/test_stride_tricks.py:458–474  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

456 assert_array_equal(arr_view, expected)
457
458 def test_errors(self):
459 i, j = np.ogrid[:4, :4]
460 arr = 10*i + j
461 with pytest.raises(ValueError, match='cannot contain negative values'):
462 sliding_window_view(arr, (-1, 3))
463 with pytest.raises(
464 ValueError,
465 match='must provide window_shape for all dimensions of `x`'):
466 sliding_window_view(arr, (1,))
467 with pytest.raises(
468 ValueError,
469 match='Must provide matching length window_shape and axis'):
470 sliding_window_view(arr, (1, 3, 4), axis=(0, 1))
471 with pytest.raises(
472 ValueError,
473 match='window shape cannot be larger than input array'):
474 sliding_window_view(arr, (5, 5))
475
476 def test_writeable(self):
477 arr = np.arange(5)

Callers

nothing calls this directly

Calls 1

sliding_window_viewFunction · 0.90

Tested by

no test coverage detected