Skip to content

Commit

Permalink
Update model.py
Browse files Browse the repository at this point in the history
Update exeption to ISO8601Error.
  • Loading branch information
shamlymajeed authored Sep 30, 2024
1 parent 96a8e0b commit 59bdfb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ingest/api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Optional
from dateutil import parser
from datetime import timedelta
from isodate import ISO8601Error

from pydantic import BaseModel
from pydantic import Field
Expand Down Expand Up @@ -335,9 +336,8 @@ def validate_wigos_id(self):
def transform_period_to_seconds(self):
try:
duration = isodate.parse_duration(self.period)
except isodate.duration.ParsingError:
raise ValueError("Invalid duration format.")

except ISO8601Error:
raise ValueError(f"Invalid ISO 8601 duration: {self.period}")
if isinstance(duration, timedelta):
# It's a simple timedelta, so just get the total seconds
total_seconds = duration.total_seconds()
Expand Down

1 comment on commit 59bdfb0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API Unit Test Coverage Report
FileStmtsMissCoverMissing
\_\_init\_\_.py00100% 
datastore_pb2.py655220%34–85
datastore_pb2_grpc.py542750%15–16, 19, 65–80, 121–123, 128–130, 135–137, 142–144, 148–173, 219, 246, 273, 300
export_metrics.py100100% 
grpc_getter.py201145%15–19, 23–26, 30–32, 36–38
locustfile.py15150%1–31
main.py43784%45, 50, 60, 70–71, 81–82
metadata_endpoints.py653152%45–54, 58, 85, 100–219, 223
response_classes.py50100% 
utilities.py1745171%20, 38, 45, 67–70, 78–89, 94–101, 121, 125, 127, 155, 161, 179, 193–194, 198, 214–218, 222–228, 232–234, 245–249, 264, 268, 290, 295
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   \_\_init\_\_.py110100% 
   covjson.py59198%91
   geojson.py21290%27, 52
openapi
   custom_dimension_examples.py40100% 
   edr_query_parameter_descriptions.py110100% 
   openapi_examples.py130100% 
routers
   \_\_init\_\_.py00100% 
   edr.py101496%348–349, 438–439
   feature.py471960%99–132, 148–153, 159–181
TOTAL72422070% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
30 0 💤 0 ❌ 0 🔥 2.044s ⏱️

Please sign in to comment.