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

Function test_ndindex

numpy/lib/tests/test_index_tricks.py:552–573  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

550
551
552def test_ndindex():
553 x = list(ndindex(1, 2, 3))
554 expected = [ix for ix, e in ndenumerate(np.zeros((1, 2, 3)))]
555 assert_array_equal(x, expected)
556
557 x = list(ndindex((1, 2, 3)))
558 assert_array_equal(x, expected)
559
560 # Test use of scalars and tuples
561 x = list(ndindex((3,)))
562 assert_array_equal(x, list(ndindex(3)))
563
564 # Make sure size argument is optional
565 x = list(ndindex())
566 assert_equal(x, [()])
567
568 x = list(ndindex(()))
569 assert_equal(x, [()])
570
571 # Make sure 0-sized ndindex works correctly
572 x = list(ndindex(*[0]))
573 assert_equal(x, [])
574
575
576def test_ndindex_zero_dimensions_explicit():

Callers

nothing calls this directly

Calls 4

ndindexClass · 0.90
ndenumerateClass · 0.90
assert_array_equalFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…