~/talk

Property Based Testing the Python Way

Talkat PyCon UK 2022 · 2022-09-16..09-18· at 14:00· Assembly Room· [testing]
slides:none on file

Compares pytest parameterize (explicit input/output lists) with Hypothesis property-based tests that use given/strategies to auto-generate inputs, shrinking failures to a minimal case and storing reproducing examples in a database. Uses a two-dice game rule set (any die of 1 → score 1; prime sum → bump to next prime) and shows Hypothesis immediately finds the missed 1,1 edge case. Claims: much shorter tests, finds surprising edge cases, shrinks failing case, integrates with pytest but can be slow and needs carefully stated properties.

AI-written summary · about

  1. 0:00Start
  2. 2:59Pytest's parametrize examples
  3. 5:11Cons of traditional testing approach
  4. 8:18Hypothesis approach
  5. 10:22Why Hypothesis
  6. 13:40Cons of Property-based approach
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.