Python Quest

Track 13 · Lesson 6 of 12

Table-driven tests with parametrize

Write one test and a table of cases with pytest.mark.parametrize, so adding a case is one line and each case is reported separately.

About 40 minIntermediate3 exercises

You will be able to

  • Replace copy-pasted tests with one parametrized test and a table of cases
  • Read pytest's report for parametrized tests, including case ids
  • Give cases readable ids with ids= or pytest.param
  • Keep separate tables for valid results and for expected errors

Included with a Formula Quest membership

It has 3 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.