diff --git a/pandas/tests/io/pytables/test_timezones.py b/pandas/tests/io/pytables/test_timezones.py index 8c8de77990a52..98a2b18d59b09 100644 --- a/pandas/tests/io/pytables/test_timezones.py +++ b/pandas/tests/io/pytables/test_timezones.py @@ -82,7 +82,13 @@ def test_append_with_timezones_dateutil(setup_path): ), index=range(5), ) - with pytest.raises(ValueError): + + msg = ( + r"invalid info for \[values_block_1\] for \[tz\], " + r"existing_value \[dateutil/.*US/Eastern\] " + r"conflicts with new value \[dateutil/.*EET\]" + ) + with pytest.raises(ValueError, match=msg): store.append("df_tz", df) # this is ok @@ -100,7 +106,13 @@ def test_append_with_timezones_dateutil(setup_path): ), index=range(5), ) - with pytest.raises(ValueError): + + msg = ( + r"invalid info for \[B\] for \[tz\], " + r"existing_value \[dateutil/.*EET\] " + r"conflicts with new value \[dateutil/.*CET\]" + ) + with pytest.raises(ValueError, match=msg): store.append("df_tz", df) # as index @@ -169,7 +181,12 @@ def test_append_with_timezones_pytz(setup_path): ), index=range(5), ) - with pytest.raises(ValueError): + + msg = ( + r"invalid info for \[values_block_1\] for \[tz\], " + r"existing_value \[US/Eastern\] conflicts with new value \[EET\]" + ) + with pytest.raises(ValueError, match=msg): store.append("df_tz", df) # this is ok @@ -187,7 +204,12 @@ def test_append_with_timezones_pytz(setup_path): ), index=range(5), ) - with pytest.raises(ValueError): + + msg = ( + r"invalid info for \[B\] for \[tz\], " + r"existing_value \[EET\] conflicts with new value \[CET\]" + ) + with pytest.raises(ValueError, match=msg): store.append("df_tz", df) # as index