Skip to content

Commit 2ad3dcf

Browse files
mabroorroberthdevries
authored andcommitted
TST: Fix bare pytest.raises in test_parsing.py (pandas-dev#32102)
1 parent 2d328e2 commit 2ad3dcf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/tests/tslibs/test_parsing.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Tests for Timestamp parsing, aimed at pandas/_libs/tslibs/parsing.pyx
33
"""
44
from datetime import datetime
5+
import re
56

67
from dateutil.parser import parse
78
import numpy as np
@@ -24,7 +25,8 @@ def test_parse_time_string():
2425

2526
def test_parse_time_string_invalid_type():
2627
# Raise on invalid input, don't just return it
27-
with pytest.raises(TypeError):
28+
msg = "Argument 'arg' has incorrect type (expected str, got tuple)"
29+
with pytest.raises(TypeError, match=re.escape(msg)):
2830
parse_time_string((4, 5))
2931

3032

@@ -217,7 +219,8 @@ def test_try_parse_dates():
217219

218220
def test_parse_time_string_check_instance_type_raise_exception():
219221
# issue 20684
220-
with pytest.raises(TypeError):
222+
msg = "Argument 'arg' has incorrect type (expected str, got tuple)"
223+
with pytest.raises(TypeError, match=re.escape(msg)):
221224
parse_time_string((1, 2, 3))
222225

223226
result = parse_time_string("2019")

0 commit comments

Comments
 (0)