Python Schoolby trefilov
Шаг 1 из 4+120 XP

Тестирование (pytest стиль)

Уверенность в коде через автотесты.

assert + pytest

# test_math.py
def add(a, b): return a + b

def test_add():
assert add(2, 3) == 5
assert add(-1, 1) == 0

Запуск: pytest -q. Параметризация — @pytest.mark.parametrize. Фикстуры — @pytest.fixture.