blog_parametrize/app/tests.py
2024-01-27 18:13:22 +00:00

25 lines
501 B
Python

# 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