Skip to content

Commit 219b067

Browse files
mrocklinjakirkham
authored andcommitted
[skip ci] Add assert_eq to testing documentation (dask#3800)
1 parent 6efcbfa commit 219b067

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

docs/source/develop.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,40 @@ You can also test certain modules or individual tests for faster response::
151151

152152
py.test dask/dataframe/tests/test_dataframe_core.py::test_set_index
153153

154-
Tests run automatically on the Travis.ci continuous testing framework on every
155-
push to every pull request on GitHub.
154+
Tests run automatically on the Travis.ci and Appveyor continuous testing
155+
frameworks on every push to every pull request on GitHub.
156+
157+
Tests are organized within the various modules' subdirectories::
158+
159+
dask/array/tests/test_*.py
160+
dask/bag/tests/test_*.py
161+
dask/dataframe/tests/test_*.py
162+
dask/diagnostics/tests/test_*.py
163+
164+
For the Dask collections like dask.array and dask.dataframe behavior is
165+
typically tested directly against the Numpy or Pandas libraries using the
166+
``assert_eq`` functions:
167+
168+
.. code-block:: python
169+
170+
import numpy as np
171+
import dask.array as da
172+
from dask.array.utils import assert_eq
173+
174+
def test_aggregations():
175+
nx = np.random.random(100)
176+
dx = da.from_array(x, chunks=(10,))
177+
178+
assert_eq(nx.sum(), dx.sum())
179+
assert_eq(nx.min(), dx.min())
180+
assert_eq(nx.max(), dx.max())
181+
...
182+
183+
This technique helps to ensure compatibility with upstream libraries, and tends
184+
to be simpler than testing correctness directly. Additionally, by passing Dask
185+
collections directly to the ``assert_eq`` function rather than call compute
186+
manually the testing suite is able to run a number of checks on the lazy
187+
collections themselves.
156188

157189

158190
Docstrings

0 commit comments

Comments
 (0)