PyCon 2019 in Cleveland, Ohio

Sunday 10 a.m.–1 p.m. in Expo Hall

Escape from auto-manual testing with Hypothesis!

Zac Hatfield-Dodds


If we knew all of the bugs we needed to write tests for, wouldn't we just... not write the bugs? So how can testing find bugs that nobody would think of? The answer is to have a computer write your tests for you! You declare what kind of input should work - from 'an integer' to 'matching this regex' to 'this Django model' and write a test which should always pass... then [Hypothesis]( searches for the smallest inputs that cause an error. If you’ve ever written tests that didn't find all your bugs, find me at the poster. It covers the theory of property-based testing, a worked example, and a whirlwind tour of the library: how to use, define, compose, and infer strategies for input; properties and testing tactics for your code; and how to debug your tests if everything seems to go wrong.