Skip to content

Commit 63a966f

Browse files
committed
Fix test formatting and following project development work flow
- establish the current poetry environment and run a complete test suite - Use the check (assrt_Type (...)) pattern required by project standards - Fix import order and code formatting through preset hook - All tests and type of chips now passionally pass
1 parent 41f7f80 commit 63a966f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DatetimeIndex(
6666
# Override the array property to return DatetimeArray instead of ExtensionArray
6767
@property
6868
def array(self) -> DatetimeArray: ...
69-
69+
7070
# various ignores needed for mypy, as we do want to restrict what can be used in
7171
# arithmetic for these types
7272
@overload # type: ignore[override]

tests/indexes/test_indexes.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
import numpy as np
1313
from numpy import typing as npt
1414
import pandas as pd
15+
from pandas.core.arrays import DatetimeArray
1516
from pandas.core.arrays.categorical import Categorical
1617
from pandas.core.indexes.base import Index
17-
from pandas.core.arrays import DatetimeArray
18-
from typing import assert_type
1918
from typing_extensions import (
2019
Never,
2120
assert_type,
@@ -1520,13 +1519,12 @@ def test_period_index_asof_locs() -> None:
15201519
)
15211520

15221521

1523-
def test_datetime_index_array_property():
1522+
def test_datetime_index_array_property() -> None:
15241523
"""Test that DatetimeIndex.array returns DatetimeArray instead of ExtensionArray."""
1525-
# Test with to_datetime
1524+
# Test with pd.to_datetime().array - this is the main issue reported
15261525
arr = pd.to_datetime(["2020-01-01", "2020-01-02"]).array
1527-
assert_type(arr, DatetimeArray)
1528-
1529-
# Test with DatetimeIndex directly
1526+
check(assert_type(arr, DatetimeArray), DatetimeArray)
1527+
1528+
# Test with DatetimeIndex constructor directly
15301529
dt_index = pd.DatetimeIndex(["2020-01-01", "2020-01-02"])
1531-
assert_type(dt_index.array, DatetimeArray)
1532-
1530+
check(assert_type(dt_index.array, DatetimeArray), DatetimeArray)

0 commit comments

Comments
 (0)