Skip to content

Commit 75b2b9c

Browse files
committed
Update error message
1 parent 4dc160b commit 75b2b9c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pandas/core/algorithms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,8 +1692,7 @@ def map_array(
16921692

16931693
if na_action == "raise" and (indexer == -1).any():
16941694
raise ValueError(
1695-
"Provided mapping is not sufficient to cover"
1696-
"all values in the input array!"
1695+
"At least one value is not covered in the mapping!"
16971696
)
16981697

16991698
new_values = take_nd(mapper._values, indexer)

pandas/tests/series/methods/test_map.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def test_map_missing_key(na_action):
327327
mapping = {1: "a", 2: "b", 3: "c"}
328328

329329
if na_action == "raise":
330-
with pytest.raises(ValueError):
330+
with pytest.raises(ValueError, match="not covered"):
331331
s.map(mapping, na_action=na_action)
332332
else:
333333
expected = Series(["a", "b", np.nan])
@@ -418,7 +418,7 @@ class DictWithoutMissing(dict):
418418
dictionary = DictWithoutMissing({3: "three"})
419419

420420
if na_action == "raise":
421-
with pytest.raises(ValueError):
421+
with pytest.raises(ValueError, match="not covered"):
422422
_ = s.map(dictionary, na_action=na_action)
423423
else:
424424
result = s.map(dictionary, na_action=na_action)
@@ -433,7 +433,7 @@ def test_map_abc_mapping(non_dict_mapping_subclass, na_action):
433433
not_a_dictionary = non_dict_mapping_subclass({3: "three"})
434434

435435
if na_action == "raise":
436-
with pytest.raises(ValueError):
436+
with pytest.raises(ValueError, match="not covered"):
437437
_ = s.map(not_a_dictionary, na_action=na_action)
438438
else:
439439
result = s.map(not_a_dictionary, na_action=na_action)

0 commit comments

Comments
 (0)