@@ -30,7 +30,7 @@ def step_impl(context):
3030 sql = select (TransducerObservation )
3131 transducer_observations = session .execute (sql ).scalars ().all ()
3232 context .transducer_observations = transducer_observations
33- assert len (transducer_observations ) > 0
33+ assert len (transducer_observations ) > 0 , "No transducer observations found"
3434
3535
3636@when ("the user requests transducer data for a non-existing well" )
@@ -52,17 +52,17 @@ def step_impl(context):
5252def step_impl (context ):
5353 data = context .response .json ()
5454 context .data = data ["items" ]
55- assert len (context .data ) > 0 , context . data
55+ assert len (context .data ) > 0 , "Expected at least one transducer data entry"
5656
5757
5858@then ("each transducer data entry should include a timestamp, value, status" )
5959def step_impl (context ):
6060 item = context .data [0 ]["observation" ]
6161 block = context .data [0 ]["block" ]
6262
63- assert "observation_datetime" in item
64- assert "value" in item
65- assert "review_status" in block
63+ assert "observation_datetime" in item , f"Expected a timestamp in the data { item } "
64+ assert "value" in item , f"Expected a value in the data { item } "
65+ assert "review_status" in block , f"Expected a review_status in the block { block } "
6666
6767 context .timestamp = item ["observation_datetime" ]
6868 context .value = item ["value" ]
@@ -75,7 +75,9 @@ def step_impl(context):
7575 from datetime import datetime
7676
7777 dt = datetime .fromisoformat (context .timestamp )
78- assert isinstance (dt , datetime )
78+ assert isinstance (
79+ dt , datetime
80+ ), f"Timestamp is not in ISO 8601 format: { context .timestamp } "
7981
8082
8183@then ("the value should be a numeric type" )
@@ -85,7 +87,7 @@ def step_impl(context):
8587
8688@then ('the status should be one of "Draft", "Corrected"' )
8789def step_impl (context ):
88- assert context .status in ("not reviewed" ,)
90+ assert context .status in ("not reviewed" ,), f"Unexpected status: { context . status } "
8991
9092
9193# ============= EOF =============================================
0 commit comments