Skip to content

Commit d67fc79

Browse files
committed
Fix pep8 error and incorporate error message suggestion
1 parent c1c310d commit d67fc79

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pandas/core/reshape/merge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ def _items_overlap_with_suffix(left: Index, right: Index, suffixes: Tuple[str, s
20742074
"""
20752075
if not isinstance(suffixes, tuple):
20762076
raise TypeError(
2077-
f"suffixes should be tuple of (str, str). But got {type(suffixes)}"
2077+
f"suffixes should be tuple of (str, str). But got {type(suffixes).__name__}"
20782078
)
20792079

20802080
to_rename = left.intersection(right)

pandas/tests/reshape/merge/test_merge.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ def test_merge_duplicate_suffix(how, expected):
20562056

20572057
@pytest.mark.parametrize(
20582058
"col1, col2, suffixes",
2059-
[("a", "a", (None, None)), ("a", "a", ("", None)), (0, 0, (None, "")),],
2059+
[("a", "a", (None, None)), ("a", "a", ("", None)), (0, 0, (None, ""))],
20602060
)
20612061
def test_merge_suffix_error(col1, col2, suffixes):
20622062
# issue: 24782
@@ -2076,7 +2076,9 @@ def test_merge_suffix_type_error(col1, col2, suffixes):
20762076
a = pd.DataFrame({col1: [1, 2, 3]})
20772077
b = pd.DataFrame({col2: [3, 4, 5]})
20782078

2079-
msg = f"suffixes should be tuple of \\(str, str\\). But got {type(suffixes)}"
2079+
msg = (
2080+
f"suffixes should be tuple of \\(str, str\\). But got {type(suffixes).__name__}"
2081+
)
20802082
with pytest.raises(TypeError, match=msg):
20812083
pd.merge(a, b, left_index=True, right_index=True, suffixes=suffixes)
20822084

0 commit comments

Comments
 (0)