Skip to content

Instantly share code, notes, and snippets.

@jangia
Created February 5, 2025 19:57
Show Gist options
  • Select an option

  • Save jangia/2c50b02a23f647dc9782e6e0a52eabb9 to your computer and use it in GitHub Desktop.

Select an option

Save jangia/2c50b02a23f647dc9782e6e0a52eabb9 to your computer and use it in GitHub Desktop.
Parametrize tests using pytest - abuse
import pytest
from email_validator import is_valid_email
@pytest.mark.parametrize(
"email,is_valid",
[
("[email protected]", True),
("gqehtjwyeumi,", False),
]
)
def test_is_valid_email(email: str, is_valid: bool):
assert is_valid_email(email) == is_valid
@pytest.mark.parametrize(
"email,is_valid",
[
("[email protected]", True),
("gqehtjwyeumi,", False),
]
)
def test_is_valid_email(email: str, is_valid: bool):
if is_valid:
assert is_valid_email(email) is True
else:
assert is_valid_email(email) is False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment