Skip to content

Commit 2e93eef

Browse files
committed
TST: fix inconsistent tests on Float64Index with missing keys
1 parent 9291c89 commit 2e93eef

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

pandas/tests/series/indexing/test_numeric.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,29 @@ def test_get_nan():
5757
assert s.get(np.nan) is None
5858
assert s.get(np.nan, default='Missing') == 'Missing'
5959

60-
# ensure that fixing the above hasn't broken get
60+
61+
def test_get_nan_multiple():
62+
# GH 8569
63+
# ensure that fixing "test_get_nan" above hasn't broken get
6164
# with multiple elements
65+
s = pd.Float64Index(range(10)).to_series()
66+
67+
idx = [2, 30]
68+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
69+
assert_series_equal(s.get(idx),
70+
Series([2, np.nan], index=idx))
71+
72+
idx = [2, np.nan]
73+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
74+
assert_series_equal(s.get(idx),
75+
Series([2, np.nan], index=idx))
76+
77+
# GH 17295 - all missing keys
6278
idx = [20, 30]
63-
assert_series_equal(s.get(idx),
64-
Series([np.nan] * 2, index=idx))
79+
assert(s.get(idx) is None)
80+
6581
idx = [np.nan, np.nan]
66-
assert_series_equal(s.get(idx),
67-
Series([np.nan] * 2, index=idx))
82+
assert(s.get(idx) is None)
6883

6984

7085
def test_delitem():

0 commit comments

Comments
 (0)