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

Function test_ndindex

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

Source from the content-addressed store, hash-verified

528
529
530def test_ndindex():
531 x = list(ndindex(1, 2, 3))
532 expected = [ix for ix, e in ndenumerate(np.zeros((1, 2, 3)))]
533 assert_array_equal(x, expected)
534
535 x = list(ndindex((1, 2, 3)))
536 assert_array_equal(x, expected)
537
538 # Test use of scalars and tuples
539 x = list(ndindex((3,)))
540 assert_array_equal(x, list(ndindex(3)))
541
542 # Make sure size argument is optional
543 x = list(ndindex())
544 assert_equal(x, [()])
545
546 x = list(ndindex(()))
547 assert_equal(x, [()])
548
549 # Make sure 0-sized ndindex works correctly
550 x = list(ndindex(*[0]))
551 assert_equal(x, [])

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