Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pandas/tests/indexing/multiindex/test_getitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def test_series_getitem_returns_scalar(


@pytest.mark.parametrize('indexer,expected_error,expected_error_msg', [
(lambda s: s.__getitem__((2000, 3, 4)), KeyError, r"^356L?$"),
(lambda s: s[(2000, 3, 4)], KeyError, r"^356L?$"),
(lambda s: s.loc[(2000, 3, 4)], KeyError, r"^356L?$"),
(lambda s: s.__getitem__((2000, 3, 4)), KeyError, r"^356$"),
(lambda s: s[(2000, 3, 4)], KeyError, r"^356$"),
(lambda s: s.loc[(2000, 3, 4)], KeyError, r"^356$"),
(lambda s: s.loc[(2000, 3, 4, 5)], IndexingError, 'Too many indexers'),
(lambda s: s.__getitem__(len(s)), IndexError, 'index out of bounds'),
(lambda s: s[len(s)], IndexError, 'index out of bounds'),
Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/indexing/multiindex/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ def test_loc_multiindex(self):
tm.assert_frame_equal(rs, xp)

# missing label
with pytest.raises(KeyError, match=r"^2L?$"):
with pytest.raises(KeyError, match=r"^2$"):
mi_int.loc[2]
with catch_warnings(record=True):
# GH 21593
with pytest.raises(KeyError, match=r"^2L?$"):
with pytest.raises(KeyError, match=r"^2$"):
mi_int.ix[2]

def test_loc_multiindex_too_many_dims(self):
Expand Down Expand Up @@ -375,15 +375,15 @@ def test_loc_getitem_int(frame_random_data_integer_multi_index):
def test_loc_getitem_int_raises_exception(
frame_random_data_integer_multi_index):
df = frame_random_data_integer_multi_index
with pytest.raises(KeyError, match=r"^3L?$"):
with pytest.raises(KeyError, match=r"^3$"):
df.loc[3]


def test_loc_getitem_lowerdim_corner(multiindex_dataframe_random_data):
df = multiindex_dataframe_random_data

# test setup - check key not in dataframe
with pytest.raises(KeyError, match=r"^11L?$"):
with pytest.raises(KeyError, match=r"^11$"):
df.loc[('bar', 'three'), 'B']

# in theory should be inserting in a sorted space????
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/series/indexing/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def test_datetime_indexing():
s = Series(len(index), index=index)
stamp = Timestamp('1/8/2000')

with pytest.raises(KeyError, match=r"^947289600000000000L?$"):
with pytest.raises(KeyError, match=r"^947289600000000000$"):
s[stamp]
s[stamp] = 0
assert s[stamp] == 0
Expand All @@ -415,7 +415,7 @@ def test_datetime_indexing():
s = Series(len(index), index=index)
s = s[::-1]

with pytest.raises(KeyError, match=r"^947289600000000000L?$"):
with pytest.raises(KeyError, match=r"^947289600000000000$"):
s[stamp]
s[stamp] = 0
assert s[stamp] == 0
Expand Down Expand Up @@ -507,7 +507,7 @@ def test_duplicate_dates_indexing(dups):
expected = Series(np.where(mask, 0, ts), index=ts.index)
assert_series_equal(cp, expected)

with pytest.raises(KeyError, match=r"^947116800000000000L?$"):
with pytest.raises(KeyError, match=r"^947116800000000000$"):
ts[datetime(2000, 1, 6)]

# new index
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ def test_series_box_timestamp():

def test_getitem_ambiguous_keyerror():
s = Series(lrange(10), index=lrange(0, 20, 2))
with pytest.raises(KeyError, match=r"^1L?$"):
with pytest.raises(KeyError, match=r"^1$"):
s[1]
with pytest.raises(KeyError, match=r"^1L?$"):
with pytest.raises(KeyError, match=r"^1$"):
s.loc[1]


Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def test_loc_getitem_setitem_integer_slice_keyerrors():

# non-monotonic, raise KeyError
s2 = s.iloc[lrange(5) + lrange(5, 10)[::-1]]
with pytest.raises(KeyError, match=r"^3L?$"):
with pytest.raises(KeyError, match=r"^3$"):
s2.loc[3:11]
with pytest.raises(KeyError, match=r"^3L?$"):
with pytest.raises(KeyError, match=r"^3$"):
s2.loc[3:11] = 0


Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def test_dot(self):
assert_almost_equal(a.dot(b['1']), expected['1'])
assert_almost_equal(a.dot(b2['1']), expected['1'])

msg = r"Dot product shape mismatch, \(4L?,\) vs \(3L?,\)"
msg = r"Dot product shape mismatch, \(4,\) vs \(3,\)"
# exception raised is of type Exception
with pytest.raises(Exception, match=msg):
a.dot(a.values[:3])
Expand Down