Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
x = 5
assert x > 0
@pytest.fixture
def mon_objet():
return {"nom": "test"}
def test_avec_fixture(mon_objet):
assert mon_objet["nom"] == "test"
@pytest.mark.skip(reason="Pas encore implémenté")
def test_nouvelle_fonctionnalite():
pass
def test_addition():
assert 1 + 1 == 2
import pytest
def test_division_par_zero():
with pytest.raises(ZeroDivisionError):
1 / 0
@pytest.mark.parametrize("entree, attendu", [(1, 2), (3, 4)])
def test_increment(entree, attendu):
assert entree + 1 == attendu