-
-
Notifications
You must be signed in to change notification settings - Fork 144
(r)true/floor div #764
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
(r)true/floor div #764
Changes from 4 commits
2473883
addb263
fd2cd07
4e941b6
c17fdb8
9a8ad78
60737de
cf93d64
607e0a0
d68a0f7
d7a0fa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from __future__ import annotations | ||
|
||
import datetime as dt | ||
import sys | ||
from typing import ( | ||
Tuple, | ||
Union, | ||
|
@@ -1025,7 +1026,7 @@ def test_new() -> None: | |
|
||
|
||
def test_timedelta_div() -> None: | ||
index = pd.Index([pd.Timedelta(1)], dtype="timedelta64[s]") | ||
index = pd.Index([pd.Timedelta(days=1)], dtype="timedelta64[s]") | ||
delta = dt.timedelta(1) | ||
|
||
check(assert_type(index / delta, "pd.Index[float]"), pd.Index, float) | ||
|
@@ -1038,11 +1039,12 @@ def test_timedelta_div() -> None: | |
check(assert_type(index // [1], pd.TimedeltaIndex), pd.TimedeltaIndex, pd.Timedelta) | ||
|
||
check(assert_type(delta / index, "pd.Index[float]"), pd.Index, float) | ||
# ZeroDivisionError | ||
# check(assert_type([delta] / index, "pd.Index[float]"), pd.Index, float) | ||
check(assert_type([delta] / index, "pd.Index[float]"), pd.Index, float) | ||
check(assert_type(delta // index, "pd.Index[int]"), pd.Index, np.longlong) | ||
# ZeroDivisionError | ||
# check(assert_type([delta] // index, "pd.Index[int]"), pd.Index, np.longlong) | ||
dtype: type[np.integer] = np.int64 | ||
if sys.platform == "win32": | ||
dtype = np.int32 | ||
check(assert_type([delta] // index, "pd.Index[int]"), pd.Index, dtype) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, using np.signedinteger worked as well :) |
||
|
||
if TYPE_CHECKING_INVALID_USAGE: | ||
1 / index # type: ignore[operator] # pyright: ignore[reportGeneralTypeIssues] | ||
|
Uh oh!
There was an error while loading. Please reload this page.