Skip to content

fix NumericIndex for nightly #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions tests/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,30 @@
import numpy as np
from numpy import typing as npt
import pandas as pd
from pandas.core.indexes.numeric import NumericIndex
from typing_extensions import (
Never,
assert_type,
)

from pandas._typing import Scalar

if TYPE_CHECKING:
from pandas._typing import IndexIterScalar

from tests import (
PD_LTE_15,
TYPE_CHECKING_INVALID_USAGE,
check,
pytest_warns_bounded,
)

if TYPE_CHECKING:
from pandas.core.indexes.numeric import NumericIndex

from pandas._typing import IndexIterScalar
else:
if not PD_LTE_15:
from pandas import Index as NumericIndex
else:
from pandas.core.indexes.numeric import NumericIndex


def test_index_unique() -> None:
df = pd.DataFrame({"x": [1, 2, 3, 4]}, index=pd.Index([1, 2, 3, 2]))
Expand Down
11 changes: 10 additions & 1 deletion tests/test_timefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import numpy as np
from numpy import typing as npt
import pandas as pd
from pandas.core.indexes.numeric import NumericIndex
import pytz
from typing_extensions import assert_type

Expand All @@ -25,6 +24,7 @@
else:
FulldatetimeDict = Any
from tests import (
PD_LTE_15,
TYPE_CHECKING_INVALID_USAGE,
check,
pytest_warns_bounded,
Expand All @@ -46,6 +46,15 @@
TimestampSeries,
)

if TYPE_CHECKING:
from pandas.core.indexes.numeric import NumericIndex

else:
if not PD_LTE_15:
from pandas import Index as NumericIndex
else:
from pandas.core.indexes.numeric import NumericIndex

# Separately define here so pytest works
np_ndarray_bool = npt.NDArray[np.bool_]

Expand Down