| 651 | "repl", [lambda: None, lambda m, x: None, lambda m, x, y=None: None] |
| 652 | ) |
| 653 | def test_replace_callable_raises(any_string_dtype, repl): |
| 654 | # GH 15055 |
| 655 | values = Series(["fooBAD__barBAD", np.nan], dtype=any_string_dtype) |
| 656 | |
| 657 | # test with wrong number of arguments, raising an error |
| 658 | msg = ( |
| 659 | r"((takes)|(missing)) (?(2)from \d+ to )?\d+ " |
| 660 | r"(?(3)required )positional arguments?" |
| 661 | ) |
| 662 | with pytest.raises(TypeError, match=msg): |
| 663 | values.str.replace("a", repl, regex=True) |
| 664 | |
| 665 | |
| 666 | @pytest.mark.parametrize( |