Introductie tot testen in Python
Alexander Levin
Data Scientist

Ketenverzoeken helpen om:
Wanneer nuttig:
# Fixture die door een andere fixture wordt gebruikt
@pytest.fixture
def setup_data():
return "I am a fixture!"
# Fixture die door de testfunctie wordt gebruikt
@pytest.fixture
def process_data(setup_data):
return setup_data.upper()
# De testfunctie
def test_process_data(process_data):
assert process_data == "I AM A FIXTURE!"
pytest-fixtures voor# Fixture die een andere fixture opvraagt
@pytest.fixture
def process_data(setup_data):
return setup_data.upper()
Introductie tot testen in Python