September 2017
Intermediate to advanced
222 pages
5h 1m
English
In Parametrized Testing, we parametrized tests. We can also parametrize fixtures. We still use our list of tasks, list of task identifiers, and an equivalence function, just as before:
| | import pytest |
| | import tasks |
| | from tasks import Task |
| | |
| | tasks_to_try = (Task('sleep', done=True), |
| | Task('wake', 'brian'), |
| | Task('breathe', 'BRIAN', True), |
| | Task('exercise', 'BrIaN', False)) |
| | |
| | task_ids = ['Task({},{},{})'.format(t.summary, t.owner, t.done) |
| | for t in tasks_to_try] |
| | |
| | |
| | def equivalent(t1, t2): |
| | """Check two tasks for equivalence.""" |
| | return ((t1.summary == t2.summary) and |
| | (t1.owner == t2.owner) and |
| | (t1.done == t2.done)) |
But now, ...
Read now
Unlock full access