Skip to content

Commit 59ba291

Browse files
committed
updates tests
1 parent ffbf31e commit 59ba291

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

climada/trajectories/test/test_snapshot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_init_valid_dates(mock_context, input_date, expected):
9595

9696

9797
def test_init_invalid_date_format(mock_context):
98-
with pytest.raises(ValueError):
98+
with pytest.raises(ValueError, match="String must be in the format"):
9999
Snapshot.from_triplet(
100100
exposure=mock_context["exp"],
101101
hazard=mock_context["haz"],
@@ -105,7 +105,9 @@ def test_init_invalid_date_format(mock_context):
105105

106106

107107
def test_init_invalid_date_type(mock_context):
108-
with pytest.raises(TypeError):
108+
with pytest.raises(
109+
TypeError, match=r"date_arg must be an int, str, or datetime.date"
110+
):
109111
Snapshot.from_triplet(exposure=mock_context["exp"], hazard=mock_context["haz"], impfset=mock_context["imp"], date=2023.5) # type: ignore
110112

111113

@@ -151,11 +153,10 @@ def test_reference(mock_context):
151153

152154

153155
def test_apply_measure(mock_context):
154-
snapshot = Snapshot(
156+
snapshot = Snapshot.from_triplet(
155157
exposure=mock_context["exp"],
156158
hazard=mock_context["haz"],
157159
impfset=mock_context["imp"],
158-
measure=None,
159160
date=2023,
160161
)
161162
new_snapshot = snapshot.apply_measure(mock_context["measure"])

0 commit comments

Comments
 (0)