Schedule

Pro tips for writing great unit tests

There is an art to condensing test concepts into readable, fast, clear predicates.

  • We look at many examples and show how they can be improve
  • Master the use of any() and all() with generator expressions.
  • Expression set() relations to express big ideas clearly.
  • Cover the problem space with combinatoric iterators: product(), combinations(), permutations()
  • Use subtests for clear error reporting
  • Factor-out data acquisition and parsing from the test predicates.
  • Learn patterns for testing edge cases.
  • Cover class based technique for test reuse.
  • Make effective use of setup and teardown.
  • We look at many examples and show how they can be improved
  • Treating TDD test cases and bug test cases with special reverence.
Speakers
Raymond Hettinger
Language
English
Topic
Python & Friends
Speaker photo

Raymond Hettinger

Twitter:
@raymondh
Pronouns:
he / him

Raymond is a distinguished contributor to the Python core. He created sets, generator expressions, the collections and itertools modules, and designed the compact-and-ordered dict.

Back to keynotes
      Powered by Vercel Logo