internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: dask/dask

Issue:
len(dask scalar) gives an error
```
Traceback (most recent call last):
  File "make-pkhalo.py", line 12, in <module>
    print(cath200['Mass'][0])
  File "/home/yfeng1/anaconda3/install/envs/cfastpm/lib/python3.6/site-packages/nbodykit/base/catalog.py", line 75, in __str__
    if len(self) > 0:
  File "/home/yfeng1/anaconda3/install/envs/cfastpm/lib/python3.6/site-packages/dask/array/core.py", line 1064, in __len__
    return sum(self.chunks[0])
IndexError: tuple index out of range
```

The error is probably valid as self is a scalar, but the message could be more informative than an out of range index error. 


Discussion:
Thanks for the issue. A quick reproducer:

```python
In [1]: import dask.array as da

In [2]: x = da.ones((), chunks=())

In [3]: x
Out[3]: dask.array<wrapped, shape=(), dtype=float64, chunksize=()>

In [4]: len(x)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-a7f4a5366567> in <module>()
----> 1 len(x)

~/Code/dask/dask/array/core.py in __len__(self)
   1112
   1113     def __len__(self):
-> 1114         return sum(self.chunks[0])
   1115
   1116     def __array_ufunc__(self, numpy_ufunc, method, *inputs, **kwargs):

IndexError: tuple index out of range
```

Should be a pretty simple fix, just need to check if `chunks` is empty, and throw a better error if so. Would you be willing to submit a PR?

Resolving patch:
diff --git a/dask/array/core.py b/dask/array/core.py
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -1111,6 +1111,8 @@ def _set_chunks(self, chunks):
     chunks = property(_get_chunks, _set_chunks, "chunks property")
 
     def __len__(self):
+        if not self.chunks:
+            raise TypeError("len() of unsized object")
         return sum(self.chunks[0])
 
     def __array_ufunc__(self, numpy_ufunc, method, *inputs, **kwargs):


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -3032,3 +3032,12 @@ def test_delayed_array_key_hygeine():
     d = delayed(identity)(a)
     b = da.from_delayed(d, shape=a.shape, dtype=a.dtype)
     assert_eq(a, b)
+
+
+def test_empty_chunks_in_array_len():
+    x = da.ones((), chunks=())
+    with pytest.raises(TypeError) as exc_info:
+        len(x)
+
+    err_msg = 'len() of unsized object'
+    assert err_msg in str(exc_info.value)
Repository: dask/dask

Issue:
Slicing list/array issue 
Someone reported this slicing issue

    da.zeros(5,chunks=5)[:,None][:,[0]*2].compute()

leads to:

```
Traceback (most recent call last):
  File "<ipython-input-154-e9a840dad4ae>", line 1, in <module>
    da.zeros(5,chunks=5)[:,None][:,[0]*2].compute()
  File "/dask/dask/base.py", line 135, in compute
    (result,) = compute(self, traverse=False, **kwargs)
  File "/dask/dask/base.py", line 329, in compute
    dsk = collections_to_dsk(variables, optimize_graph, **kwargs)
  File "/dask/dask/base.py", line 240, in collections_to_dsk
    for opt, (dsk, keys) in groups.items()))
  File "/dask/dask/base.py", line 240, in <genexpr>
    for opt, (dsk, keys) in groups.items()))
  File "/dask/dask/array/optimization.py", line 46, in optimize
    dsk5 = optimize_slices(dsk4)
  File "/dask/dask/array/optimization.py", line 134, in optimize_slices
    c_index = fuse_slice(b_index, a_index)
  File "/dask/dask/array/optimization.py", line 285, in fuse_slice
    result.append(fuse_slice(a[i], b[j]))  # Common case
  File "/dask/dask/array/optimization.py", line 223, in fuse_slice
    if a is None and b == slice(None, None):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
```


Discussion:

Resolving patch:
diff --git a/dask/array/optimization.py b/dask/array/optimization.py
--- a/dask/array/optimization.py
+++ b/dask/array/optimization.py
@@ -220,7 +220,7 @@ def fuse_slice(a, b):
     None
     """
     # None only works if the second side is a full slice
-    if a is None and b == slice(None, None):
+    if a is None and isinstance(b, slice) and b == slice(None, None):
         return None
 
     # Replace None with 0 and one in start and step


Test patch:
diff --git a/dask/array/tests/test_optimization.py b/dask/array/tests/test_optimization.py
--- a/dask/array/tests/test_optimization.py
+++ b/dask/array/tests/test_optimization.py
@@ -139,6 +139,9 @@ def test_fuse_slice():
 
     with pytest.raises(NotImplementedError):
         fuse_slice(slice(10, 15, 2), -1)
+    # Regression test for #3076
+    with pytest.raises(NotImplementedError):
+        fuse_slice(None, np.array([0, 0]))
 
 
 def test_fuse_slice_with_lists():
Repository: dask/dask

Issue:
ddf.to_parquet(append=True) error when file not existing
When I try to save to parquet with append = True, in the first time (the file is absent), I get an error, I fixed it using this code 

```
append = False 
if os.path.exsists(file):
    append = True 
ddf.to_parquet(append = append) 
```

Is it a good idea to create a pool request with this code inside the to_parquet method?

Thanks.



Discussion:
Just want to chime in to say I do the same thing and would appreciate this change. 

Resolving patch:
diff --git a/dask/dataframe/io/parquet.py b/dask/dataframe/io/parquet.py
--- a/dask/dataframe/io/parquet.py
+++ b/dask/dataframe/io/parquet.py
@@ -399,7 +399,12 @@ def _write_fastparquet(df, fs, fs_token, path, write_index=None, append=False,
         index_cols = []
 
     if append:
-        pf = fastparquet.api.ParquetFile(path, open_with=fs.open, sep=sep)
+        try:
+            pf = fastparquet.api.ParquetFile(path, open_with=fs.open, sep=sep)
+        except (IOError, ValueError):
+            # append for create
+            append = False
+    if append:
         if pf.file_scheme not in ['hive', 'empty', 'flat']:
             raise ValueError('Requested file scheme is hive, '
                              'but existing file scheme is not.')


Test patch:
diff --git a/dask/dataframe/io/tests/test_parquet.py b/dask/dataframe/io/tests/test_parquet.py
--- a/dask/dataframe/io/tests/test_parquet.py
+++ b/dask/dataframe/io/tests/test_parquet.py
@@ -287,6 +287,27 @@ def test_append(tmpdir, engine):
     assert_eq(df, ddf3)
 
 
+def test_append_create(tmpdir):
+    """Test that appended parquet equal to the original one."""
+    check_fastparquet()
+    tmp = str(tmpdir)
+    df = pd.DataFrame({'i32': np.arange(1000, dtype=np.int32),
+                       'i64': np.arange(1000, dtype=np.int64),
+                       'f': np.arange(1000, dtype=np.float64),
+                       'bhello': np.random.choice(['hello', 'yo', 'people'],
+                                                  size=1000).astype("O")})
+    df.index.name = 'index'
+
+    half = len(df) // 2
+    ddf1 = dd.from_pandas(df.iloc[:half], chunksize=100)
+    ddf2 = dd.from_pandas(df.iloc[half:], chunksize=100)
+    ddf1.to_parquet(tmp, append=True)
+    ddf2.to_parquet(tmp, append=True)
+
+    ddf3 = dd.read_parquet(tmp, engine='fastparquet')
+    assert_eq(df, ddf3)
+
+
 def test_append_with_partition(tmpdir):
     check_fastparquet()
     tmp = str(tmpdir)
Repository: dask/dask

Issue:
[pyarrow] Passing `partition_on` when writing parquet files ignores keyword parameters
[dask.dataframe.io.parquet._write_partition_pyarrow](https://github.com/dask/dask/blob/63338bcf126c0904787f3f644784485621419ae4/dask/dataframe/io/parquet.py#L644) doesn't forward any passed `kwargs` when there is `partition_on`; in my use case passing `use_deprecated_int96_timestamps=True` is effectively ignored.


Discussion:

Resolving patch:
diff --git a/dask/dataframe/io/parquet.py b/dask/dataframe/io/parquet.py
--- a/dask/dataframe/io/parquet.py
+++ b/dask/dataframe/io/parquet.py
@@ -641,7 +641,8 @@ def _write_partition_pyarrow(df, path, fs, filename, write_index,
     t = pa.Table.from_pandas(df, preserve_index=write_index)
 
     if partition_on:
-        parquet.write_to_dataset(t, path, partition_cols=partition_on, filesystem=fs)
+        parquet.write_to_dataset(t, path, partition_cols=partition_on,
+                                 filesystem=fs, **kwargs)
     else:
         with fs.open(filename, 'wb') as fil:
             parquet.write_table(t, fil, **kwargs)


Test patch:
diff --git a/dask/dataframe/io/tests/test_parquet.py b/dask/dataframe/io/tests/test_parquet.py
--- a/dask/dataframe/io/tests/test_parquet.py
+++ b/dask/dataframe/io/tests/test_parquet.py
@@ -546,7 +546,7 @@ def test_to_parquet_default_writes_nulls(tmpdir):
 @write_read_engines(
     xfail_pyarrow_fastparquet=pyarrow_fastparquet_msg,
     xfail_pyarrow_pyarrow=("Race condition writing using pyarrow with partition_on. "
-                           "Fixed on master, but not on pyarrow 0.7.0")
+                           "Fixed on master, but not on pyarrow 0.8.0")
 )
 def test_partition_on(tmpdir, write_engine, read_engine):
     tmpdir = str(tmpdir)
@@ -929,6 +929,13 @@ def test_parse_pandas_metadata_column_with_index_name():
 
 def test_writing_parquet_with_kwargs(tmpdir, engine):
     fn = str(tmpdir)
+    path1 = os.path.join(fn, 'normal')
+    path2 = os.path.join(fn, 'partitioned')
+
+    df = pd.DataFrame({'a': np.random.choice(['A', 'B', 'C'], size=100),
+                       'b': np.random.random(size=100),
+                       'c': np.random.randint(1, 5, size=100)})
+    ddf = dd.from_pandas(df, npartitions=3)
 
     engine_kwargs = {
         'pyarrow': {
@@ -943,10 +950,18 @@ def test_writing_parquet_with_kwargs(tmpdir, engine):
         }
     }
 
-    ddf.to_parquet(fn,  engine=engine, **engine_kwargs[engine])
-    out = dd.read_parquet(fn, engine=engine)
+    ddf.to_parquet(path1,  engine=engine, **engine_kwargs[engine])
+    out = dd.read_parquet(path1, engine=engine)
     assert_eq(out, df, check_index=(engine != 'fastparquet'))
 
+    # Avoid race condition in pyarrow 0.8.0 on writing partitioned datasets
+    with dask.set_options(get=dask.get):
+        ddf.to_parquet(path2, engine=engine, partition_on=['a'],
+                       **engine_kwargs[engine])
+    out = dd.read_parquet(path2, engine=engine).compute()
+    for val in df.a.unique():
+        assert set(df.b[df.a == val]) == set(out.b[out.a == val])
+
 
 def test_writing_parquet_with_unknown_kwargs(tmpdir, engine):
     fn = str(tmpdir)
Repository: dask/dask

Issue:
LZ4_compress and LZ4_uncompress removed
Since commit python-lz4/python-lz4@d62fdc50c0e183d7260961f09d4e0701fbdf0c5c LZ4_compress and LZ4_decompress have been removed (they've been deprecated for a while). With the version of python-lz4 released on pypi, it means we can't use lz4 compression with dask, and worse importing dask.bytes.compression errors out.



Discussion:

Resolving patch:
diff --git a/dask/bytes/compression.py b/dask/bytes/compression.py
--- a/dask/bytes/compression.py
+++ b/dask/bytes/compression.py
@@ -33,10 +33,17 @@ def noop_file(file, **kwargs):
     decompress['snappy'] = snappy.decompress
 
 
-with ignoring(ImportError):
-    import lz4
-    compress['lz4'] = lz4.LZ4_compress
-    decompress['lz4'] = lz4.LZ4_uncompress
+try:
+    import lz4.block
+    compress['lz4'] = lz4.block.compress
+    compress['lz4'] = lz4.block.decompress
+except ImportError:
+    try:
+        import lz4
+        compress['lz4'] = lz4.LZ4_compress
+        compress['lz4'] = lz4.LZ4_uncompress
+    except ImportError:
+        pass
 
 with ignoring(ImportError):
     from ..compatibility import LZMAFile, lzma_compress, lzma_decompress


Test patch:
Repository: dask/dask

Issue:
custom node names in graphs
Custom node names in graphs using `delayed` do not wok. In the following code:

```python
@dask.delayed(name='some-random-name')
def fn(a):
    return a

res = fn(4)
res.visualize()
```

The node is still called `fn`. 

Using dask 0.17.1 on Python 3.6.4



Discussion:

Resolving patch:
diff --git a/dask/delayed.py b/dask/delayed.py
--- a/dask/delayed.py
+++ b/dask/delayed.py
@@ -132,7 +132,9 @@ def delayed(obj, name=None, pure=None, nout=None, traverse=True):
         The function or object to wrap
     name : string or hashable, optional
         The key to use in the underlying graph for the wrapped object. Defaults
-        to hashing content.
+        to hashing content. Note that this only affects the name of the object
+        wrapped by this call to delayed, and *not* the output of delayed
+        function calls - for that use ``dask_key_name=`` as described below.
     pure : bool, optional
         Indicates whether calling the resulting ``Delayed`` object is a pure
         operation. If True, arguments to the call are hashed to produce


Test patch:
Repository: dask/dask

Issue:
Inconsistency between doc and code for repartition?
The docstring for dataframe.repartition states
```
npartitions : int, optional
    Number of partitions of output, must be less than npartitions of
    input.
```

yet there seems to be working code for increasing the number of partitions.

```

import numpy as np
import pandas as pd
import dask.dataframe as dd

X = np.random.normal(size=(1_000_000, 2))
df = pd.DataFrame(X, columns=['A', 'B'])
ddf = dd.from_pandas(df, npartitions=5)
ddf2 = ddf.repartition(npartitions=10)
assert ddf.npartitions == 5
assert ddf2.npartitions == 10
assert np.allclose((ddf**2).compute(), (ddf2**2).compute())
```

This is with dask 0.17.2, Python 3.6, pandas 0.22.0.


Discussion:
Indeed.  This used to be a limitation, but is no longer.  We should remove
the text from the docstring.  Any interest in submitting a small PR for
this?

On Wed, Apr 25, 2018 at 3:56 AM, Jörg Dietrich <notifications@github.com>
wrote:

> The docstring for dataframe.repartition states
>
> npartitions : int, optional
>     Number of partitions of output, must be less than npartitions of
>     input.
>
> yet there seems to be working code for increasing the number of partitions.
>
>
> import numpy as np
> import pandas as pd
> import dask.dataframe as dd
>
> X = np.random.normal(size=(1_000_000, 2))
> df = pd.DataFrame(X, columns=['A', 'B'])
> ddf = dd.from_pandas(df, npartitions=5)
> ddf2 = ddf.repartition(npartitions=10)
> assert ddf.npartitions == 5
> assert ddf2.npartitions == 10
> assert np.allclose((ddf**2).compute(), (ddf2**2).compute())
>
> This is with dask 0.17.2, Python 3.6, pandas 0.22.0.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/dask/dask/issues/3439>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASszCgjrnCy0DKXj6r3L0sUh0E2Irgfks5tsCw3gaJpZM4Ti8jm>
> .
>


Resolving patch:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -939,8 +939,8 @@ def repartition(self, divisions=None, npartitions=None, freq=None, force=False):
             List of partitions to be used. If specified npartitions will be
             ignored.
         npartitions : int, optional
-            Number of partitions of output, must be less than npartitions of
-            input. Only used if divisions isn't specified.
+            Number of partitions of output. Only used if divisions isn't
+            specified.
         freq : str, pd.Timedelta
             A period on which to partition timeseries data like ``'7D'`` or
             ``'12h'`` or ``pd.Timedelta(hours=12)``.  Assumes a datetime index.


Test patch:
Repository: dask/dask

Issue:
Dataframe groupby()[column].agg fails with AttributeError
Minimal not working example (dask 0.17.2, pandas 0.22.0, Python 3.6):

```
import pandas as pd
from dask import dataframe as dd

df = pd.DataFrame({'A': [1, 2, 3, 1, 2, 3, 1, 2, 4],
        'B': [-0.776, -0.4, -0.873,  0.054,  1.419, -0.948, -0.967, -1.714,
              -0.666]})
ddf = dd.from_pandas(df, npartitions=1)
ddf.groupby('A')['B'].agg('var')
```

```
AttributeError                            Traceback (most recent call last)
<ipython-input-1-b43466d1ae6a> in <module>()
      6               -0.666]})
      7 ddf = dd.from_pandas(df, npartitions=1)
----> 8 ddf.groupby('A')['B'].agg('var')
      9 
     10 

~/applications/anaconda3/lib/python3.6/site-packages/dask/dataframe/groupby.py in agg(self, arg, split_every, split_out)
   1217     @derived_from(pd.core.groupby.SeriesGroupBy)
   1218     def agg(self, arg, split_every=None, split_out=1):
-> 1219         return self.aggregate(arg, split_every=split_every, split_out=split_out)

~/applications/anaconda3/lib/python3.6/site-packages/dask/dataframe/groupby.py in aggregate(self, arg, split_every, split_out)
   1211 
   1212         if not isinstance(arg, (list, dict)):
-> 1213             result = result[result.columns[0]]
   1214 
   1215         return result

AttributeError: 'Series' object has no attribute 'columns'
```


Discussion:
Confirmed.  Thank you for the excellent bug report @joergdietrich .

The solution to this seems straightforward; we should only do this transformation when the result object is a DataFrame rather than a Series.  Do you have any interest in submitting this as a pull request?  Most of the work is already done with your excellent test case above.

Resolving patch:
diff --git a/dask/dataframe/groupby.py b/dask/dataframe/groupby.py
--- a/dask/dataframe/groupby.py
+++ b/dask/dataframe/groupby.py
@@ -1221,7 +1221,7 @@ def aggregate(self, arg, split_every=None, split_out=1):
         if self._slice:
             result = result[self._slice]
 
-        if not isinstance(arg, (list, dict)):
+        if not isinstance(arg, (list, dict)) and isinstance(result, DataFrame):
             result = result[result.columns[0]]
 
         return result


Test patch:
diff --git a/dask/dataframe/tests/test_groupby.py b/dask/dataframe/tests/test_groupby.py
--- a/dask/dataframe/tests/test_groupby.py
+++ b/dask/dataframe/tests/test_groupby.py
@@ -1429,3 +1429,13 @@ def impl(s):
     expected = expected['cc'].groupby([expected['g0'], expected['g1']]).agg('sum')
 
     assert_eq(actual, expected)
+
+
+def test_groupby_select_column_agg():
+    pdf = pd.DataFrame({'A': [1, 2, 3, 1, 2, 3, 1, 2, 4],
+                        'B': [-0.776, -0.4, -0.873, 0.054, 1.419, -0.948,
+                              -0.967, -1.714, -0.666]})
+    ddf = dd.from_pandas(pdf, npartitions=4)
+    actual = ddf.groupby('A')['B'].agg('var')
+    expected = pdf.groupby('A')['B'].agg('var')
+    assert_eq(actual, expected)
Repository: dask/dask

Issue:
Duplicate variable definition in docs/source/conf.py
The `intersphinx_mapping` definition looks duplicated in docs/source/conf.py

https://github.com/dask/dask/blob/master/docs/source/conf.py#L302

It's not hurting anything, but there's 6 lines you can probably delete.


Discussion:
Hrm, indeed.  Any interest in submitting a PR with a fix?

On Mon, Apr 30, 2018 at 11:59 PM, Diane Trout <notifications@github.com>
wrote:

> The intersphinx_mapping definition looks duplicated in docs/source/conf.py
>
> https://github.com/dask/dask/blob/master/docs/source/conf.py#L302
>
> It's not hurting anything, but there's 6 lines you can probably delete.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/dask/dask/issues/3451>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASszPaUmIEpQ25ZQX6OWhyuGFu_xYRgks5tt928gaJpZM4Ttio9>
> .
>


Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -299,13 +299,6 @@
 
 #  --Options for sphinx extensions -----------------------------------------------
 
-intersphinx_mapping = {'pandas': ('http://pandas.pydata.org/pandas-docs/stable/',
-                                  'http://pandas.pydata.org/pandas-docs/stable/objects.inv'),
-                       'numpy': ('https://docs.scipy.org/doc/numpy/',
-                                 'https://docs.scipy.org/doc/numpy/objects.inv')}
-
-#  --Options for sphinx extensions -----------------------------------------------
-
 intersphinx_mapping = {'pandas': ('http://pandas.pydata.org/pandas-docs/stable/',
                                   'http://pandas.pydata.org/pandas-docs/stable/objects.inv'),
                        'numpy': ('https://docs.scipy.org/doc/numpy/',


Test patch:
Repository: dask/dask

Issue:
Incorrect result from computing when cache is enabled in 0.18.
Here is a reproducer:
```
(base) [yfeng1@waterfall tmp]$ cat test_nbkit.py 
import numpy
import dask
import dask.array as da
from dask.cache import Cache
print(dask.__version__)

with Cache(800000):
    a2 = da.from_array(numpy.ones((10, 3)) * 2, chunks=10000)
    a3 = da.from_array(numpy.ones((10, 3)) * 3, chunks=10000)

    print(a2.compute())
    print(a3.compute())

(base) [yfeng1@waterfall tmp]$ python test_nbkit.py 
0.18.0
[[2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]]
[[2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]]
```

0.18 has already hit anaconda. 


Discussion:

Resolving patch:
diff --git a/dask/base.py b/dask/base.py
--- a/dask/base.py
+++ b/dask/base.py
@@ -246,11 +246,13 @@ def unpack_collections(*args, **kwargs):
     collections = []
     repack_dsk = {}
 
+    collections_token = uuid.uuid4().hex
+
     def _unpack(expr):
         if is_dask_collection(expr):
             tok = tokenize(expr)
             if tok not in repack_dsk:
-                repack_dsk[tok] = (getitem, 'collections', len(collections))
+                repack_dsk[tok] = (getitem, collections_token, len(collections))
                 collections.append(expr)
             return tok
 
@@ -277,7 +279,7 @@ def _unpack(expr):
 
     def repack(results):
         dsk = repack_dsk.copy()
-        dsk['collections'] = quote(results)
+        dsk[collections_token] = quote(results)
         return local.get_sync(dsk, out)
 
     return collections, repack


Test patch:
diff --git a/dask/tests/test_cache.py b/dask/tests/test_cache.py
--- a/dask/tests/test_cache.py
+++ b/dask/tests/test_cache.py
@@ -48,6 +48,18 @@ def test_cache_with_number():
     assert c.cache.limit == 1
 
 
+def test_cache_correctness():
+    # https://github.com/dask/dask/issues/3631
+    c = Cache(10000)
+    da = pytest.importorskip('dask.array')
+    from numpy import ones, zeros
+    z = da.from_array(zeros(1), chunks=10)
+    o = da.from_array(ones(1), chunks=10)
+    with c:
+        assert (z.compute() == 0).all()
+        assert (o.compute() == 1).all()
+
+
 def f(duration, size, *args):
     sleep(duration)
     return [0] * size