Skip to content

Commit e1b5781

Browse files
committed
add tests on merge validation; add asof as valid mergetype
1 parent 79e9055 commit e1b5781

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/reshape/merge/test_merge.py

+15
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,21 @@ def test_merge_readonly(self):
14561456

14571457
data1.merge(data2) # no error
14581458

1459+
def test_merge_how_validation(self):
1460+
# https://github.com/pandas-dev/pandas/issues/59422
1461+
data1 = DataFrame(
1462+
np.arange(20).reshape((4, 5)) + 1, columns=["a", "b", "c", "d", "e"]
1463+
)
1464+
data2 = DataFrame(
1465+
np.arange(20).reshape((5, 4)) + 1, columns=["a", "b", "x", "y"]
1466+
)
1467+
msg = (
1468+
"'full' is not a valid Merge type "
1469+
"('left', 'right', 'inner', 'outer', 'cross', 'asof')"
1470+
)
1471+
with pytest.raises(ValueError, match=re.escape(msg)):
1472+
data1.merge(data2, how="full")
1473+
14591474

14601475
def _check_merge(x, y):
14611476
for how in ["inner", "left", "outer"]:

0 commit comments

Comments
 (0)