aesara-devs / aesara

Aesara is a Python library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays.
https://aesara.readthedocs.io
Other
1.18k stars 155 forks source link

Convert a test to use Hypothesis #1507

Open etellman opened 1 year ago

etellman commented 1 year ago

This is a proof of concept for Hypothesis tests. I selected a test that was easy to convert and replaced the existing test with hard-coded values with a few tests that use Hypothesis.

Since it was pretty easy to do, I also added tests for complex inputs. One thing I discovered is that cscalar doesn't work for any of the numpy functions. Hypothesis inevitably finds a value that can't be represented precisely and the test fails. All the functions work with zscalar.

see: https://github.com/aesara-devs/aesara/issues/197

Thank you for opening a PR!

Here are a few important guidelines and requirements to check before your PR can be merged:

Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

brandonwillard commented 1 year ago

This looks great, thanks! Will review shortly.

etellman commented 1 year ago

This looks great, thanks! Will review shortly.

Sounds good. Let me know what you think.

It looks like I missed a few Black issues, so I fixed them (I hope) with this commit: https://github.com/aesara-devs/aesara/pull/1507/commits/fa832d4fa099090c4d678b7140425042cc96a65f