Re:Show HN: Python Tests That Write Themselves
by hchasestevens on Wednesday September 18, 2019 @01:22PM
(#21007656)
This is neatly packaged, but it's not immediately clear what advantages it has over Hypothesis' native offerings for accomplishing this? ( https://hypothesis.readthedocs.io/en/latest/details.html#inf... and https://hypothesis.readthedocs.io/en/latest/data.html#hypoth... )
[ Parent
| on HN ]
Re:Show HN: Python Tests That Write Themselves
by timothycrosley on Wednesday September 18, 2019 @01:42PM
(#21007885)
It's an extension for hypothesis, and its value is 100% just convenience and accessibility. Really, it's meant to be a sort of gateway to doing full property-based testing, in the least barrier way possible. I wrote a bit more about why I created it here: https://timothycrosley.com/project-5-hypothesis-auto
Re:Show HN: Python Tests That Write Themselves
by OJFord on Wednesday September 18, 2019 @06:07PM
(#21010794)
Hypothesis' `infer` is inferring arguments to the test fn, that you'd then use to drive the fn under test.
OP's extension is inferring arguments to the fn under test, and then generating a test like 'assert isinstancee(fn_under_test(a, *kw), expected_ret_type)` to go with them.
You can do more types of test with `infer` (i.e. not just 'does return' and 'returns correct type' but also 'returns correct value'), but this is an easy way to cover a lot of basic return checking ground.