Skip to content

Commit 08e4baf

Browse files
author
Mark Graham
authored
TST: add messages to bare pytest raises in pandas/tests/io/pytables/test_timezones.py (#37975)
1 parent bc537b7 commit 08e4baf

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

pandas/tests/io/pytables/test_timezones.py

+26-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ def test_append_with_timezones_dateutil(setup_path):
8282
),
8383
index=range(5),
8484
)
85-
with pytest.raises(ValueError):
85+
86+
msg = (
87+
r"invalid info for \[values_block_1\] for \[tz\], "
88+
r"existing_value \[dateutil/.*US/Eastern\] "
89+
r"conflicts with new value \[dateutil/.*EET\]"
90+
)
91+
with pytest.raises(ValueError, match=msg):
8692
store.append("df_tz", df)
8793

8894
# this is ok
@@ -100,7 +106,13 @@ def test_append_with_timezones_dateutil(setup_path):
100106
),
101107
index=range(5),
102108
)
103-
with pytest.raises(ValueError):
109+
110+
msg = (
111+
r"invalid info for \[B\] for \[tz\], "
112+
r"existing_value \[dateutil/.*EET\] "
113+
r"conflicts with new value \[dateutil/.*CET\]"
114+
)
115+
with pytest.raises(ValueError, match=msg):
104116
store.append("df_tz", df)
105117

106118
# as index
@@ -169,7 +181,12 @@ def test_append_with_timezones_pytz(setup_path):
169181
),
170182
index=range(5),
171183
)
172-
with pytest.raises(ValueError):
184+
185+
msg = (
186+
r"invalid info for \[values_block_1\] for \[tz\], "
187+
r"existing_value \[US/Eastern\] conflicts with new value \[EET\]"
188+
)
189+
with pytest.raises(ValueError, match=msg):
173190
store.append("df_tz", df)
174191

175192
# this is ok
@@ -187,7 +204,12 @@ def test_append_with_timezones_pytz(setup_path):
187204
),
188205
index=range(5),
189206
)
190-
with pytest.raises(ValueError):
207+
208+
msg = (
209+
r"invalid info for \[B\] for \[tz\], "
210+
r"existing_value \[EET\] conflicts with new value \[CET\]"
211+
)
212+
with pytest.raises(ValueError, match=msg):
191213
store.append("df_tz", df)
192214

193215
# as index

0 commit comments

Comments
 (0)