Hacker News new | ask | show | jobs
by OJFord 2468 days ago
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.