Skip to content

TST: add messages to bare pytest raises in pandas/tests/io/pytables/test_timezones.py #37975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions pandas/tests/io/pytables/test_timezones.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import re

import numpy as np
import pytest
Expand Down Expand Up @@ -82,7 +83,13 @@ def test_append_with_timezones_dateutil(setup_path):
),
index=range(5),
)
with pytest.raises(ValueError):

msg = re.escape(
"invalid info for [values_block_1] for [tz], "
"existing_value [dateutil//usr/share/zoneinfo/US/Eastern] "
"conflicts with new value [dateutil//usr/share/zoneinfo/EET]"
)
with pytest.raises(ValueError, match=msg):
store.append("df_tz", df)

# this is ok
Expand All @@ -100,7 +107,13 @@ def test_append_with_timezones_dateutil(setup_path):
),
index=range(5),
)
with pytest.raises(ValueError):

msg = re.escape(
"invalid info for [B] for [tz], "
"existing_value [dateutil//usr/share/zoneinfo/EET] "
"conflicts with new value [dateutil//usr/share/zoneinfo/CET]"
)
with pytest.raises(ValueError, match=msg):
store.append("df_tz", df)

# as index
Expand Down Expand Up @@ -169,7 +182,12 @@ def test_append_with_timezones_pytz(setup_path):
),
index=range(5),
)
with pytest.raises(ValueError):

msg = re.escape(
"invalid info for [values_block_1] for [tz], "
"existing_value [US/Eastern] conflicts with new value [EET]"
)
with pytest.raises(ValueError, match=msg):
store.append("df_tz", df)

# this is ok
Expand All @@ -187,7 +205,12 @@ def test_append_with_timezones_pytz(setup_path):
),
index=range(5),
)
with pytest.raises(ValueError):

msg = re.escape(
"invalid info for [B] for [tz], "
"existing_value [EET] conflicts with new value [CET]"
)
with pytest.raises(ValueError, match=msg):
store.append("df_tz", df)

# as index
Expand Down