blog_parametrize/app/tests.py

26 lines
501 B
Python
Raw Normal View History

2024-01-27 19:13:22 +01:00
# coding: utf-8
import pytest
from waffle.testutils import override_switch
from app.code import simple, complex_function
@pytest.mark.parametrize(
"name",
(
"foo bar",
"baz zab",
"1 2 3 4 5"
)
)
def test_simple(name):
assert " " not in simple(name)
@pytest.mark.parametrize("switch", (True, False))
@pytest.mark.django_db
def test_complex_function(switch):
with override_switch("new_complex", active=switch):
assert complex_function(2, 2) == 4