Skip to content

Commit 0634ddf

Browse files
committed
TST: remove some warnings in test_nanops
1 parent d635fab commit 0634ddf

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pandas/tests/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ def test_multiindex_perf_warn(self):
16931693
@slow
16941694
def test_multiindex_get_loc(self): # GH7724, GH2646
16951695

1696-
with warnings.catch_warnings(PerformanceWarning):
1696+
with warnings.catch_warnings(record=True):
16971697

16981698
# test indexing into a multi-index before & past the lexsort depth
16991699
from numpy.random import randint, choice, randn

pandas/tests/test_nanops.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from functools import partial
55

6+
import warnings
67
import numpy as np
78
from pandas import Series
89
from pandas.core.common import isnull, is_integer_dtype
@@ -135,7 +136,7 @@ def _coerce_tds(targ, res):
135136
return targ, res
136137

137138
try:
138-
if axis != 0 and hasattr(targ, 'shape') and targ.ndim:
139+
if axis != 0 and hasattr(targ, 'shape') and targ.ndim and targ.shape != res.shape:
139140
res = np.split(res, [targ.shape[0]], axis=0)[0]
140141
except:
141142
targ, res = _coerce_tds(targ, res)
@@ -364,10 +365,11 @@ def test_returned_dtype(self):
364365
"return dtype expected from %s is %s, got %s instead" % (method, dtype, result.dtype))
365366

366367
def test_nanmedian(self):
367-
self.check_funs(nanops.nanmedian, np.median,
368-
allow_complex=False, allow_str=False, allow_date=False,
369-
allow_tdelta=True,
370-
allow_obj='convert')
368+
with warnings.catch_warnings(record=True):
369+
self.check_funs(nanops.nanmedian, np.median,
370+
allow_complex=False, allow_str=False, allow_date=False,
371+
allow_tdelta=True,
372+
allow_obj='convert')
371373

372374
def test_nanvar(self):
373375
self.check_funs_ddof(nanops.nanvar, np.var,

0 commit comments

Comments
 (0)