test_text_utils.py
python_old/pytest-workshop/pytest-workshop-solutions/tests/test_text_utils.py
import pytest
from src.text_utils import slugify
@pytest.mark.parametrize("inp,expected", [
("Hello World", "hello-world"),
(" multiple spaces ", "multiple-spaces"),
("Symbols!@#$", "symbols"),
("MiXeD-Case", "mixed-case"),
("", ""),
(" ", ""),
], ids=["basic","spaces","symbols","case","empty","spaces-only"])
def test_slugify(inp, expected):
assert slugify(inp) == expected
@pytest.mark.xfail(reason="accent stripping not implemented", strict=False)
def test_slugify_accents():
assert slugify("Café à la carte") == "cafe-a-la-carte"
Articoli correlati
01_classical_caesar_cipher.py
01_classical_caesar_cipher.py — python source code from the python old learning materials (python_old/Cryptography/01_classical_caesar_cipher.py).
Leggi l'articolo →02_classical_monoalphabetic.py
02_classical_monoalphabetic.py — python source code from the python old learning materials (python_old/Cryptography/02_classical_monoalphabetic.py).
Leggi l'articolo →03_classical_rail_fence.py
03_classical_rail_fence.py — python source code from the python old learning materials (python_old/Cryptography/03_classical_rail_fence.py).
Leggi l'articolo →04_frequency_analysis.py
04_frequency_analysis.py — python source code from the python old learning materials (python_old/Cryptography/04_frequency_analysis.py).
Leggi l'articolo →05_cryptographic_hashing.py
05_cryptographic_hashing.py — python source code from the python old learning materials (python_old/Cryptography/05_cryptographic_hashing.py).
Leggi l'articolo →06_password_hashing.py
06_password_hashing.py — python source code from the python old learning materials (python_old/Cryptography/06_password_hashing.py).
Leggi l'articolo →