2019-09-03, 09:00–10:30, Track 3 (Oteiza)
Testing research code can be difficult, but is essential for robust results. Using Hypothesis, a tool for property-based testing, I'll show how testing can be both easier and dramatically more powerful - even for complex "black box" codes.
Hypothesis is a testing package that will search for counterexamples to your
assertions – so you can write tests that provide a high-level description of your
code or system, and let the computer attempt a Popperian falsification. If it
fails, your code is (probably) OK… and if it succeeds you have a minimal input
Come along and learn the principles of property-based testing, how to use
Hypothesis, and how to use it to check scientific code – whether highly-polished
You can even use it to test 'black boxes', such as simulations, where we have no
way of independently verifying that some input leads to the right output!
Intrigued? Come and learn about the power of embedding assertions in your
code, and metamorphic relations in your tests!