-
-
Notifications
You must be signed in to change notification settings - Fork 145
feat(series): truediv for bools #1314
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
base: main
Are you sure you want to change the base?
Conversation
|
||
def test_truediv_py_scalar() -> None: | ||
"""Test pd.Series[bool] / Python native scalars""" | ||
i, f, c = 1, 1.0, 1j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valid to add a test with b=True
in the divisor and the dividend
|
||
def test_truediv_py_sequence() -> None: | ||
"""Test pd.Series[bool] / Python native sequence""" | ||
i, f, c = [2, 3, 5], [1.0, 2.0, 3.0], [1j, 1j, 4j] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valid to have b = [True, False, True]
here
|
||
def test_truediv_numpy_array() -> None: | ||
"""Test pd.Series[bool] / numpy array""" | ||
i = np.array([2, 3, 5], np.int64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can add a b=np.array([True, False, True], np.bool_)
here
|
||
def test_truediv_pd_series() -> None: | ||
"""Test pd.Series[bool] / pandas series""" | ||
i = pd.Series([2, 3, 5]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the only case where you can't test b=pd.Series([True, False, True])
because it will fail at runtime in all these operations.
Ideally, it would be cool to have a if TYPE_CHECKING_INVALID_USAGE:
when b
is involved to see if we can catch this usage with static typing.
@@ -10,7 +10,7 @@ | |||
|
|||
def test_truediv_py_scalar() -> None: | |||
"""Test pd.Series[float] / Python native scalars""" | |||
i, f, c = 1, 1.0, 1j | |||
b, i, f, c = True, 1, 1.0, 1j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this function and other funcs in this file, you have to add the tests for b
This is inspired by #1312 (comment) and a follow-up for #1311.
assert_type()
to assert the type of any return value