Skip to content

Commit

Permalink
fix(ecmwf_mars): Failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Dec 17, 2024
1 parent 9ae58d3 commit 0c6a8dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:
)
del dss

if "ens" in ECMWFMARSRawRepository.model().name:
if "ens" in ECMWFMARSRawRepository.model().name.lower():
# Add in missing coordinates for mean/std data
if "enfo-es" in path.name:
ds = ds.expand_dims(dim={"ensemble_stat": ["std"]})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import dataclasses
import datetime as dt
import os
import pathlib
import unittest
from unittest.mock import patch

from returns.result import Failure, ResultE, Success

Expand All @@ -12,6 +14,7 @@
class TestECMWFMARSEModelREpository(unittest.TestCase):
"""Test the business methods of the ECMWFRealTimeS3RawRepository class."""

@patch.dict(os.environ, {"MODEL": "ens-stat-uk"}, clear=True)
def test__convert(self) -> None:
"""Test the _convert method."""

Expand Down Expand Up @@ -50,7 +53,6 @@ class TestCase:

for t in tests:
with self.subTest(name=t.filename):
# Attempt to convert the file
result = ECMWFMARSRawRepository._convert(
path=pathlib.Path(__file__).parent.absolute() / "test_gribs" / t.filename,
)
Expand All @@ -66,3 +68,4 @@ class TestCase:
self.assertIsInstance(region_result, Failure, msg=f"{region_result}")
else:
self.assertIsInstance(region_result, Success, msg=f"{region_result}")

0 comments on commit 0c6a8dd

Please sign in to comment.