"""Test slugs.""" from .. import util from pymdownx import slugs class TestUslugify(util.MdCase): """Test Unicode slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case="lower") } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing unicode-slugs_headers ±♠Ωℑ', r'

Testing unicode-slugs_headers ±♠Ωℑ

' ) class TestUslugifyEncoded(util.MdCase): """Test Unicode encoded slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case="lower", percent_encode=True) } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing unicode-slugs_headers ±♠Ωℑ with encoding', r'

' 'Testing unicode-slugs_headers ±♠Ωℑ with encoding

' ) class TestUslugifyCased(util.MdCase): """Test Unicode cased slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify() } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing cased unicode-slugs_headers ±♠Ωℑ', r'

Testing cased unicode-slugs_headers ±♠Ωℑ

' ) class TestUslugifyCasedEncoded(util.MdCase): """Test Unicode cased, encoded slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(percent_encode=True) } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing cased unicode-slugs_headers ±♠Ωℑ with encoding', r'

' 'Testing cased unicode-slugs_headers ±♠Ωℑ with encoding

' ) class TestGFM(util.MdCase): """Test GitHub Flavored Markdown style slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case="lower-ascii") } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing GFM unicode-slugs_headers ±♠Ωℑ', r'

Testing GFM unicode-slugs_headers ±♠Ωℑ

' ) class TestGFMEncoded(util.MdCase): """Test encoded GitHub Flavored Markdown style slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case="lower-ascii", percent_encode=True) } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Testing GFM unicode-slugs_headers ±♠Ωℑ with encoding', r'

' r'Testing GFM unicode-slugs_headers ±♠Ωℑ with encoding

' ) class TestNormalize(util.MdCase): """Test different normalization methods.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(normalize='NFD') } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# Théâtre', r'

Théâtre

' ) class TestFold(util.MdCase): """Test different normalization methods.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case='fold') } } def test_slug(self): """Test the slug output.""" self.check_markdown( r'# ß', r'

ß

' )