Skip to content

Skip testing negative integer exponents for pow related functions #66

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 1 commit into from
Jan 7, 2022
Merged
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
6 changes: 6 additions & 0 deletions xptests/test_operators_and_elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,12 @@ def test_pow(
):
left = data.draw(left_strat, label=left_sym)
right = data.draw(right_strat, label=right_sym)
if right_is_scalar:
if isinstance(right, int):
assume(right >= 0)
else:
if dh.is_int_dtype(right.dtype):
assume(xp.all(right >= 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if hypothesis doesn't complain then we shouldn't worry about it, but wouldn't this filter a large fraction of examples?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Hypothesis hasn't complained yet here heh. assume is very useful as otherwise I'd need some mechanism to inject a test-specific strategy, but I'll mull over on if I can figure out a nicer (more performative!) solution here.


try:
func(left, right)
Expand Down