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
Add allow_subnormal
passthrough to strategies.numpy.from_dtype()
for complex values
#3558
Conversation
Does this need any tests? |
I think you're right we forgot about this, or at least thought it was low-prio at the time given "subnormal complex numbers" is something hopefully no one has to think about haha. Thanks for your contribution!
I think generally we need tests for subnormal support in hypothesis/hypothesis-python/tests/array_api/test_arrays.py Lines 492 to 511 in 39e3fba
and hypothesis/hypothesis-python/tests/array_api/test_from_dtype.py Lines 92 to 107 in 39e3fba
(FYI Feel free to take a stab at copying these tests, and extending them for complex numbers too, but I'll try to sit down and properly think about this over the weekend. |
I also hope so 😆 I'm honestly not too eager to add the tests for this ... 😅 If you will have a look anyways, then I will cowardly retreat here. |
Seconding @honno here, I think we just forgot 😅. And in case our pretty pedantic review process made you wonder, we really deeply appreciate all your PRs! Thanks so much for helping us to improve Hypothesis 😍 |
😁 Nice! Your framework is awesome btw! It's an honour to contribute to it. You aim of "pushing software quality" of the Python ecosystem may sound a bit ambitious but I think it aptly describes your impact. 🥳 And yeah, just a few weeks ago I realized that I'd need complex numbers in my research (never would have expected that) and was suprised how much support for it was already lurking in python, hypothesis, numpy, pytorch, ... So I figures I'd do the "last" steps here for everyone to be able to fully use it in my project for testing some numerical algorithms. |
I'm a bit confused regarding the |
Yeah the auto-release process messed up somehow as |
allow_subnormal
passthrough to strategies.numpy.from_dtype for complex valuesallow_subnormal
passthrough to strategies.numpy.from_dtype()
for complex values
Once this is merged, I'll add the pass-through of |
Had something come up so just to say I'll have another go this weekend 😅 |
So I introduced basic tests in I noticed this PR currently doesn't update the following helpful error logic for FTZ subnormal behaviour
Would be nice to update this, even if it is just a nicety (a less-specific helpful error should raise anyway right now), so will explore. It does feel a bit mute given we're not going to test this on CI or expect users/ourselves to have to work out how to build FTZ NumPy (where in the We also didn't update this behaviour for |
Nice! 🧑🔬
That's true, but isn't that already handled by the function, since it eventually calls hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/numbers.py Lines 446 to 478 in 956684c
I'm honestly not too much into this, for me it already looked like it was working fine. 😅 |
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.
Thanks again @felixdivo!
I think this was just forgotten.
Related to #3468.