"""Test slugs."""
from .. import util
import pytest
from pymdownx import slugs
class TestUslugify(util.MdCase):
"""Test Unicode slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.uslugify
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing unicode-slugs_headers ±♠Ωℑ',
r'
'
)
class TestUslugifyEncoded(util.MdCase):
"""Test Unicode encoded slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.uslugify_encoded
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing unicode-slugs_headers ±♠Ωℑ with encoding',
r''
)
class TestUslugifyCased(util.MdCase):
"""Test Unicode cased slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.uslugify_cased
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing cased unicode-slugs_headers ±♠Ωℑ',
r''
)
class TestUslugifyCasedEncoded(util.MdCase):
"""Test Unicode cased, encoded slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.uslugify_cased_encoded
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing cased unicode-slugs_headers ±♠Ωℑ with encoding',
r''
)
class TestGFM(util.MdCase):
"""Test GitHub Flavored Markdown style slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.gfm
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing GFM unicode-slugs_headers ±♠Ωℑ',
r''
)
class TestGFMEncoded(util.MdCase):
"""Test encoded GitHub Flavored Markdown style slugs."""
extension = ['markdown.extensions.toc']
extension_configs = {
'markdown.extensions.toc': {
"slugify": slugs.gfm_encoded
}
}
def test_slug(self):
"""Test the slug output."""
with pytest.warns(DeprecationWarning):
self.check_markdown(
r'# Testing GFM unicode-slugs_headers ±♠Ωℑ with encoding',
r''
)