MCPcopy Create free account
hub / github.com/dask/dask / test_nonzero

Function test_nonzero

dask/array/tests/test_routines.py:2009–2021  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2007
2008
2009def test_nonzero():
2010 for shape, chunks in [(0, ()), ((0, 0), (0, 0)), ((15, 16), (4, 5))]:
2011 x = np.random.default_rng().integers(10, size=shape)
2012 d = da.from_array(x, chunks=chunks)
2013
2014 x_nz = np.nonzero(x)
2015 d_nz = da.nonzero(d)
2016
2017 assert isinstance(d_nz, type(x_nz))
2018 assert len(d_nz) == len(x_nz)
2019
2020 for i in range(len(x_nz)):
2021 assert_eq(d_nz[i], x_nz[i])
2022
2023
2024def test_nonzero_method():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
nonzeroMethod · 0.80
integersMethod · 0.45

Tested by

no test coverage detected