-
Notifications
You must be signed in to change notification settings - Fork 45
Add multi-dimensional arrays support for existing elementwise tests #23
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
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9d982d8
Implemented test_trunc
honno 4439c81
Improved test_trunc
honno 1ff0af7
Test with ndarrays for test_round
honno 9f1d58c
Use ndarrays for test_remainder
honno e002817
Use ndarrays for test_pow
honno f57d8c4
Use ndarrays for test_positive
honno 652daa3
Use ndarrays for test_not_equal
honno e73866c
Use ndarrays for test_negative
honno 88118f0
Use ndarrays for test_multiply
honno 14f1dad
Use ndarrays for logical tests, alias _array_module as xp
honno cd0a108
Use ndarrays for log tests
honno 6d440af
Use ndarrays for less/greater tests
honno 5adab4f
Use ndarrays for nan and inf tests
honno 5ec583e
Use ndarrays for floor and exp tests
honno d6807b0
Use ndarrays for cos/ceil/divide tests
honno 14b056b
Use ndarrays for abs and some inverse trig tests
honno df5038a
Alias array module and helper modules
honno fb3ddb7
Define `xps` in `__init__.py`
honno 5531563
Force high max examples for `test_kwargs`
honno 0bb4d65
Use `ah.assert_integral` in `test_trunc`
honno f7838d3
Support and use ndarrays for bitwise tests
honno 5b0c49a
Use finite mask for `test_trunc`
honno 3315e18
`two_mutual_arrays()` returns two strategies
honno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from hypothesis.extra.array_api import make_strategies_namespace | ||
|
||
from . import _array_module as xp | ||
|
||
|
||
xps = make_strategies_namespace(xp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the purpose of this? Isn't max_examples already 100 by default? If we set the
--max-examples
flag at the command line (see conftest.py) which takes precedence?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.
Yep
@settings
takes precedence over everything else. I do this so this test should pass even when we use--max-examples=1
. This is actually what a few tests in Hypothesis does, to prevent false-negatives.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 don't understand why you would ever pass max-examples=1. And even if you did, why wouldn't want it to apply to this test? I typically use max-examples to increase the number of examples to do a more rigorous test run.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hmm, a few times now I've run
pytest --max-examples=1
for the whole suite, so I thought forcingmax_examples
here would reduce noise for myself and generally prevent any noisy false-negatives if someone else had the same idea. Generally I think it clarifies that we're not using Hypothesis to test things, but testing Hypothesis itself i.e. see if our custom strategy will work for a "typical" run. I imagine both of these reasons are why Hypothesis does this internally too.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.
Does this test fail if it is run with max_examples=1?
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.
Yep, as expected. In Hypothesis this kind of
max_example
forcing would be covered by theirfind_any
util.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.
How this
test_kwargs
test method tries to find that certain things will be generated is essentially whatfind_any
does in their own test suite.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 see. I missed that. I didn't notice that this was on an inner test function, not the outer one.