diff --git a/pandas-stubs/core/indexes/accessors.pyi b/pandas-stubs/core/indexes/accessors.pyi index 1ce5dfdb..735da79f 100644 --- a/pandas-stubs/core/indexes/accessors.pyi +++ b/pandas-stubs/core/indexes/accessors.pyi @@ -167,7 +167,7 @@ class _DatetimeRoundingMethods(Generic[_DTTimestampTimedeltaReturnType]): def round( self, freq: str | BaseOffset | None, - ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., + ambiguous: Literal["raise", "infer", "NaT"] | bool | np_ndarray_bool = ..., nonexistent: ( Literal["shift_forward", "shift_backward", "NaT", "raise"] | timedelta @@ -177,7 +177,7 @@ class _DatetimeRoundingMethods(Generic[_DTTimestampTimedeltaReturnType]): def floor( self, freq: str | BaseOffset | None, - ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., + ambiguous: Literal["raise", "infer", "NaT"] | bool | np_ndarray_bool = ..., nonexistent: ( Literal["shift_forward", "shift_backward", "NaT", "raise"] | timedelta @@ -187,7 +187,7 @@ class _DatetimeRoundingMethods(Generic[_DTTimestampTimedeltaReturnType]): def ceil( self, freq: str | BaseOffset | None, - ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., + ambiguous: Literal["raise", "infer", "NaT"] | bool | np_ndarray_bool = ..., nonexistent: ( Literal["shift_forward", "shift_backward", "NaT", "raise"] | timedelta diff --git a/pyproject.toml b/pyproject.toml index 9b967bf5..c22fd5b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "1.15.0" pandas = "2.2.3" pyarrow = ">=10.0.1" pytest = ">=7.1.2" -pyright = ">=1.1.396" +pyright = ">=1.1.396,!=1.1.398" poethepoet = ">=0.16.5" loguru = ">=0.6.0" typing-extensions = ">=4.4.0" diff --git a/tests/test_io.py b/tests/test_io.py index cca219c4..0397629e 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -43,7 +43,6 @@ from pandas._testing import ensure_clean import pytest import sqlalchemy -import sqlalchemy.ext.declarative import sqlalchemy.orm import sqlalchemy.orm.decl_api from typing_extensions import assert_type diff --git a/tests/test_timefuncs.py b/tests/test_timefuncs.py index e8d2e477..40ee3295 100644 --- a/tests/test_timefuncs.py +++ b/tests/test_timefuncs.py @@ -489,16 +489,31 @@ def test_series_dt_accessors() -> None: pd.Series, pd.Timestamp, ) + check( + assert_type(s0.dt.round("D", ambiguous=False), "TimestampSeries"), + pd.Series, + pd.Timestamp, + ) check( assert_type(s0.dt.floor("D", nonexistent=dt.timedelta(1)), "TimestampSeries"), pd.Series, pd.Timestamp, ) + check( + assert_type(s0.dt.floor("D", ambiguous=False), "TimestampSeries"), + pd.Series, + pd.Timestamp, + ) check( assert_type(s0.dt.ceil("D", nonexistent=dt.timedelta(1)), "TimestampSeries"), pd.Series, pd.Timestamp, ) + check( + assert_type(s0.dt.ceil("D", ambiguous=False), "TimestampSeries"), + pd.Series, + pd.Timestamp, + ) check(assert_type(s0.dt.month_name(), "pd.Series[str]"), pd.Series, str) check(assert_type(s0.dt.day_name(), "pd.Series[str]"), pd.Series, str) check(assert_type(s0.dt.unit, TimeUnit), str)