Introducing Diane Tchuindjo to the project

195 views
Skip to first unread message

Aaron Meurer

unread,
Jul 5, 2023, 12:36:41 PM7/5/23
to sympy
Hi everyone.

As many of you may know, I work at Quansight, a company that works
with and funds a lot of open source work in the Python ecosystem.
Quansight Labs has a yearly internship program where interns work on
various open source projects.

I'm happy to announce that this summer, Diane Tchuindjo will be
interning at Quansight Labs to work on SymPy. Her project will be to
introduce Hypothesis into the SymPy test suite. Everyone join me in
welcoming Diane to the project.

You can read more about the project here
https://github.com/sympy/sympy/issues/20914. Basically, hypothesis
(https://hypothesis.readthedocs.io/en/latest/) is a Python testing
library that uses property based tests. This lets you write tests that
take generic inputs and test functions using exact mathematical
properties, rather than only testing explicit inputs and outputs. For
example, to take an example from the issue, a Hypothesis test for
factorint() might look like

from hypothesis import given
from hypothesis.strategies import integers

@given(integers())
def test_factorint(x):
f = factorint(x)
assert Mul(*[b**e for b, e in f.items()]) == x
for b in f:
assert abs(b) in [0, 1] or isprime(b)

(as opposed to the existing factorint tests, which just test explicit
inputs and outputs
https://github.com/sympy/sympy/blob/master/sympy/ntheory/tests/test_factor_.py#L168).
This test generates an integer, runs factorint() on it, and tests that
the result is mathematically correct (i.e., that the factors are prime
and multiply back together to the original integer).

This is somewhat like random testing, except Hypothesis is actually a
lot more sophisticated than a purely random test, because it always
tries to generate interesting examples, and it also does things like
shrinking test inputs, and makes input strategies easy to compose. In
my experience, Hypothesis is *really* good at finding bugs that you
would otherwise never find.

Hypothesis has always been a good fit for SymPy, but we've as of yet
never used it. Our plan is to start small, to prove its usefulness,
but I'm confident we will be able to convince the SymPy community that
Hypothesis is a tool that we should be using regularly in the SymPy
test suite.

Aaron Meurer

Oscar Benjamin

unread,
Jul 18, 2023, 6:32:31 PM7/18/23
to sy...@googlegroups.com
Hi Diane and welcome,

I'm looking forward to seeing hypothesis used with SymPy. It seems
like it could be really useful and I looked at it a few times but I
just couldn't quite get my head round what the workflow would be, like
exactly how we could use it...

If you can figure that out (and explain it to everyone) then I am sure
that we can put it to good use!

Oscar
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Js_3keq-UcmRQDaVtu2mhagBgVauTBpS%3DKyO4vYSWQ3A%40mail.gmail.com.

Diane T

unread,
Jul 26, 2023, 1:37:21 PM7/26/23
to sympy
Hi Oscar and (all)

I'm definitely excited to be working a the intersection of Hypothesis and Sympy! Looking to receiving input in the future.

Diane
Reply all
Reply to author
Forward
0 new messages