Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Oct 12, 2023
1 parent 5533020 commit 64a60c2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/unit/test_pyam_compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from unittest import mock

import pandas as pd
import pytest

from scmdata.pyam_compat import LongDatetimeIamDataFrame
Expand All @@ -13,9 +14,18 @@ def test_to_int_value_error(test_iam_df):
postion = 4
idf.loc[postion, "time"] = bad_val

error_msg = re.escape(
f"Unknown string format: {bad_val} present at position {postion}"
)
if pd.__version__.startswith("1"):
error_msg = re.escape(
f"Unknown string format: {bad_val} present at position {postion}"
)

else:
error_msg = re.escape(
f'time data "{bad_val}" '
"doesn't match format "
'"%Y/%m/%d", at position 4. You might want to try:'
)

with pytest.raises(ValueError, match=error_msg):
LongDatetimeIamDataFrame(idf)

Expand Down

0 comments on commit 64a60c2

Please sign in to comment.