Skip to content

Conversation

@crusaderky
Copy link
Collaborator

@crusaderky crusaderky commented Jul 5, 2018

Closes #3721
Fixes everything except complex numbers, which I don't know how they're supposed to work in plain numpy to begin with...

Copy link
Member

@mrocklin mrocklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for tracking this down and fixing things @crusaderky

I've added a few comments, mostly cosmetic

def test_arange_has_dtype():
assert da.arange(5, chunks=2).dtype == np.arange(5).dtype
# Unexpected or missing kwargs
with assert_raises(TypeError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the codebase we use the fully qualified name with pytest.raises(...). I suggest that we stick to this for uniformity (and also fully qualified names are nice sometimes :)).

assert da.arange(5, chunks=2).dtype == np.arange(5).dtype
# Unexpected or missing kwargs
with assert_raises(TypeError):
da.arange(10, chunks=-1, unexpected=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice (but not mandatory) to include the following check:

with pytest.raises(TypeError) as info:
    da.arange(10, chunks=-1, unexpected=True)
assert 'unexpected' in str(info.value)

with assert_raises(TypeError):
da.arange(10, chunks=-1, unexpected=True)
with assert_raises(TypeError):
da.arange(10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it might be nice (but not mandatory) to ensure that the user is pointed towards the chunks= keyword.

def test_arange_dtypes(start, stop, step, dtype):
a_np = np.arange(start, stop, step, dtype=dtype)
a_da = da.arange(start, stop, step, dtype=dtype, chunks=-1)
assert a_np.dtype == a_da.dtype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should be checked automatically in assert_eq. If not then we should put it there instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is checked, however I don't know (and I don't want to rely upon) if it is checked before or after compute() which in this case makes a lot of difference

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that it is checked both before and after. If I'm wrong and it isn't then it should be.

@crusaderky
Copy link
Collaborator Author

crusaderky commented Jul 5, 2018

@mrocklin could you please assist with this CI failure? https://travis-ci.org/dask/dask/jobs/400540686#L1337-L1352

@mrocklin
Copy link
Member

mrocklin commented Jul 6, 2018

The CI failure has been patched up for now. I believe that you may have to merge with master though.

@crusaderky
Copy link
Collaborator Author

@mrocklin new CI failure. Could you help again?

coverage run /home/travis/miniconda/envs/test-environment/bin/py.test dask --runslow --doctest-modules 
coverage: command not found

@mrocklin
Copy link
Member

mrocklin commented Jul 7, 2018 via email

@mrocklin
Copy link
Member

mrocklin commented Jul 7, 2018 via email

@mrocklin
Copy link
Member

mrocklin commented Jul 7, 2018

Looks good to me. Thanks @crusaderky !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants