2019-09-03 –, 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
to debug.
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
or quick-and-dirty!
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!
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.
Python Skill Level –professional
Domain Expertise –some
Domains –General-purpose Python
Zac is a researcher at the Australian National University’s 3A Institute, which is building a new applied science to 'manage the machines' - AI, cyber-physical systems, and other new technologies.
He started using Python to analyse huge environmental datasets, and contributing to libraries like Xarray to make such analysis easier for all scientists. Now, as a maintainer of Hypothesis, Pytest, and Trio, Zac is still passionate about making it easy to write software you can understand and rely on.
When not at a computer he can usually be found surrounded by books of all kinds, the Australian bush, or both.