AI engineering glossary · Python advanced

What is parametrized test?

Parametrized test (also called pytest.mark.parametrize): A test written once and run repeatedly with different input and expected-output pairs. In pytest it uses @pytest.mark.parametrize, reducing duplicated tests and covering edge cases neatly. Each combination is reported as its own test result.

Level: intermediateTopic: Python advanced

Parametrized test: an example

@pytest.mark.parametrize('x,y', [(1, 2), (5, 6)]) def test_inc(x, y): assert inc(x) == y runs twice.

Related terms

More Python advanced terms

Where you learn it

Parametrized test is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.