Skip to content

Commit 22cc773

Browse files
committed
TST: comments and skipif for broken warning catching
1 parent 1847584 commit 22cc773

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pandas/tests/indexing/test_indexing.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pandas.core.indexing import _non_reducing_slice, _maybe_numeric_slice
2020
from pandas import NaT, DataFrame, Index, Series, MultiIndex
2121
import pandas.util.testing as tm
22+
from pandas.compat import PY2
2223

2324
from pandas.tests.indexing.common import Base, _mklbl
2425

@@ -131,6 +132,8 @@ def test_setitem_dtype_upcast(self):
131132
assert is_float_dtype(left['foo'])
132133
assert is_float_dtype(left['baz'])
133134

135+
@pytest.mark.skipif(PY2, reason=("Catching warnings unreliable with "
136+
"Python 2 (GH #20770)"))
134137
def test_dups_fancy_indexing(self):
135138

136139
# GH 3455
@@ -192,6 +195,7 @@ def test_dups_fancy_indexing(self):
192195
result = df.loc[rows]
193196
tm.assert_frame_equal(result, expected)
194197

198+
# List containing only missing label
195199
dfnu = DataFrame(np.random.randn(5, 3), index=list('AABCD'))
196200
with pytest.raises(KeyError):
197201
dfnu.ix[['E']]

pandas/tests/indexing/test_loc.py

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pandas.util import testing as tm
1313
from pandas.tests.indexing.common import Base
1414
from pandas.api.types import is_scalar
15+
from pandas.compat import PY2
1516

1617

1718
class TestLoc(Base):
@@ -152,6 +153,8 @@ def test_loc_getitem_label_list(self):
152153
[Timestamp('20130102'), Timestamp('20130103')],
153154
typs=['ts'], axes=0)
154155

156+
@pytest.mark.skipif(PY2, reason=("Catching warnings unreliable with "
157+
"Python 2 (GH #20770)"))
155158
def test_loc_getitem_label_list_with_missing(self):
156159
self.check_result('list lbl', 'loc', [0, 1, 2], 'indexer', [0, 1, 2],
157160
typs=['empty'], fails=KeyError)

0 commit comments

Comments
 (0)