-
-
Notifications
You must be signed in to change notification settings - Fork 143
(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 6 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 |
---|---|---|
|
@@ -1022,3 +1022,30 @@ def test_new() -> None: | |
pd.IntervalIndex, | ||
pd.Interval, | ||
) | ||
|
||
|
||
def test_timedelta_div() -> None: | ||
index = pd.Index([pd.Timedelta(1)], dtype="timedelta64[s]") | ||
delta = dt.timedelta(1) | ||
|
||
check(assert_type(index / delta, "pd.Index[float]"), pd.Index, float) | ||
check(assert_type(index / [delta], "pd.Index[float]"), pd.Index, float) | ||
check(assert_type(index / 1, pd.TimedeltaIndex), pd.TimedeltaIndex, pd.Timedelta) | ||
check(assert_type(index / [1], pd.TimedeltaIndex), pd.TimedeltaIndex, pd.Timedelta) | ||
check(assert_type(index // delta, "pd.Index[int]"), pd.Index, np.longlong) | ||
check(assert_type(index // [delta], "pd.Index[int]"), pd.Index, int) | ||
check(assert_type(index // 1, pd.TimedeltaIndex), pd.TimedeltaIndex, pd.Timedelta) | ||
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) | ||
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 if you did 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, that made it work! |
||
check(assert_type(delta // index, "pd.Index[int]"), pd.Index, np.longlong) | ||
Dr-Irv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# ZeroDivisionError | ||
# check(assert_type([delta] // index, "pd.Index[int]"), pd.Index, np.longlong) | ||
|
||
if TYPE_CHECKING_INVALID_USAGE: | ||
1 / index # type: ignore[operator] # pyright: ignore[reportGeneralTypeIssues] | ||
[1] / index # type: ignore[operator] # pyright: ignore[reportGeneralTypeIssues] | ||
1 // index # type: ignore[operator] # pyright: ignore[reportGeneralTypeIssues] | ||
[1] // index # type: ignore[operator] # pyright: ignore[reportGeneralTypeIssues] |
Uh oh!
There was an error while loading. Please reload this page.