Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pramatrization matrix

If we add several separate decorators, then we create a matrix of all the test cases. This for example will run 3x3 = 9 test-cases.

import mymath
import pytest

@pytest.mark.parametrize("a", [1, 2, 3])
@pytest.mark.parametrize("b", [4, 5, 6])
def test_add(a, b):
    assert mymath.add(a, b) > 0