Skip to content

Commit

Permalink
chore: Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisjared committed Dec 9, 2024
1 parent 0f9d7d4 commit b36e493
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ref/src/ref/datasets/cmip6.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _parse_datetime(dt_str: pd.Series[str]) -> pd.Series[datetime | Any]:
Pandas tries to coerce everything to their own datetime format, which is not what we want here.
"""

def _inner(date_string):
def _inner(date_string: str | None) -> datetime | None:
if not date_string:
return None

Expand Down
4 changes: 2 additions & 2 deletions packages/ref/tests/unit/datasets/test_cmip6.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def check(df: pd.DataFrame, basename: str):

def test_parse_datetime():
pd.testing.assert_series_equal(
_parse_datetime(pd.Series(["2021-01-01 00:00:00", "1850-01-17 00:29:59.999993"])),
_parse_datetime(pd.Series(["2021-01-01 00:00:00", "1850-01-17 00:29:59.999993", None])),
pd.Series(
[datetime.datetime(2021, 1, 1, 0, 0), datetime.datetime(1850, 1, 17, 0, 29, 59, 999993)],
[datetime.datetime(2021, 1, 1, 0, 0), datetime.datetime(1850, 1, 17, 0, 29, 59, 999993), None],
dtype="object",
),
)
Expand Down

0 comments on commit b36e493

Please sign in to comment.