-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Silence some warnings. #2328
Silence some warnings. #2328
Changes from 13 commits
482ecf6
6b46b15
75cce6c
7518bd7
7186644
1f1ec52
9ac15ef
76f988f
f605d6e
9729f29
cee7e2a
fbdb206
b985127
d9e8024
2c0ed18
a74f4e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,11 @@ | |
|
||
class DaskTestCase(TestCase): | ||
def assertLazyAnd(self, expected, actual, test): | ||
with dask.set_options(get=dask.get): | ||
|
||
with (dask.config.set(get=dask.get) if hasattr(dask, 'config') | ||
else dask.set_options(get=dask.get)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this just a version check? Generally, I prefer to see a version comparison so we can more obviously clean these things up when older versions are no longer supported. (Same comment below) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya it's basically a version check. I've made it an explicit version check now. |
||
test(actual, expected) | ||
|
||
if isinstance(actual, Dataset): | ||
for k, v in actual.variables.items(): | ||
if k in actual.dims: | ||
|
@@ -196,11 +199,13 @@ def test_missing_methods(self): | |
except NotImplementedError as err: | ||
assert 'dask' in str(err) | ||
|
||
@pytest.mark.filterwarnings('ignore::PendingDeprecationWarning') | ||
def test_univariate_ufunc(self): | ||
u = self.eager_var | ||
v = self.lazy_var | ||
self.assertLazyAndAllClose(np.sin(u), xu.sin(v)) | ||
|
||
@pytest.mark.filterwarnings('ignore::PendingDeprecationWarning') | ||
def test_bivariate_ufunc(self): | ||
u = self.eager_var | ||
v = self.lazy_var | ||
|
@@ -421,6 +426,7 @@ def duplicate_and_merge(array): | |
actual = duplicate_and_merge(self.lazy_array) | ||
self.assertLazyAndEqual(expected, actual) | ||
|
||
@pytest.mark.filterwarnings('ignore::PendingDeprecationWarning') | ||
def test_ufuncs(self): | ||
u = self.eager_array | ||
v = self.lazy_array | ||
|
@@ -821,7 +827,8 @@ def test_basic_compute(): | |
dask.multiprocessing.get, | ||
dask.local.get_sync, | ||
None]: | ||
with dask.set_options(get=get): | ||
with (dask.config.set(get=get) if hasattr(dask, 'config') | ||
else dask.set_options(get=get)): | ||
ds.compute() | ||
ds.foo.compute() | ||
ds.foo.variable.compute() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -672,6 +672,7 @@ def test_isel_types(self): | |
assert_identical(da.isel(x=np.array([0], dtype="int64")), | ||
da.isel(x=np.array([0]))) | ||
|
||
@pytest.mark.filterwarnings('ignore::DeprecationWarning') | ||
def test_isel_fancy(self): | ||
shape = (10, 7, 6) | ||
np_array = np.random.random(shape) | ||
|
@@ -845,6 +846,7 @@ def test_isel_drop(self): | |
selected = data.isel(x=0, drop=False) | ||
assert_identical(expected, selected) | ||
|
||
@pytest.mark.filterwarnings("ignore:Dataset.isel_points") | ||
def test_isel_points(self): | ||
shape = (10, 5, 6) | ||
np_array = np.random.random(shape) | ||
|
@@ -1237,6 +1239,7 @@ def test_reindex_like_no_index(self): | |
ValueError, 'different size for unlabeled'): | ||
foo.reindex_like(bar) | ||
|
||
@pytest.mark.filterwarnings('ignore:Indexer has dimensions') | ||
def test_reindex_regressions(self): | ||
# regression test for #279 | ||
expected = DataArray(np.random.randn(5), coords=[("time", range(5))]) | ||
|
@@ -1286,7 +1289,7 @@ def test_swap_dims(self): | |
|
||
def test_expand_dims_error(self): | ||
array = DataArray(np.random.randn(3, 4), dims=['x', 'dim_0'], | ||
coords={'x': np.linspace(0.0, 1.0, 3.0)}, | ||
coords={'x': np.linspace(0.0, 1.0, 3)}, | ||
attrs={'key': 'entry'}) | ||
|
||
with raises_regex(ValueError, 'dim should be str or'): | ||
|
@@ -3529,6 +3532,8 @@ def test_rolling_reduce(da, center, min_periods, window, name): | |
@pytest.mark.parametrize('min_periods', (None, 1, 2, 3)) | ||
@pytest.mark.parametrize('window', (1, 2, 3, 4)) | ||
@pytest.mark.parametrize('name', ('sum', 'max')) | ||
@pytest.mark.filterwarnings('ignore:Using a non-tuple sequence') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silences a warning that seems to be thrown by code in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch -- can you file a report in bottleneck? I expect this would be easy to fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Filed a report upstream pydata/bottleneck#194 and reverted this commit. |
||
# root cause of the warning is bottleneck | ||
def test_rolling_reduce_nonnumeric(center, min_periods, window, name): | ||
da = DataArray([0, np.nan, 1, 2, np.nan, 3, 4, 5, np.nan, 6, 7], | ||
dims='time').isnull() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is really nice! way better than using filterwarnings manually :)