summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorVal Neekman <val@neekware.com>2019-07-27 22:39:01 -0400
committerVal Neekman <val@neekware.com>2019-07-27 22:39:01 -0400
commitb6067d10fc140d30d5d8860f28758e56faa59b4e (patch)
tree2a980cf9c460cec9844fc4e739625bb9b2d75bca /test.py
parenta0cd8fd1608ff63b150bac9c6b32786a00bffc80 (diff)
downloadpython-slugify-b6067d10fc140d30d5d8860f28758e56faa59b4e.tar.gz
update readme, add pydoc
Diffstat (limited to 'test.py')
-rw-r--r--test.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/test.py b/test.py
index 78b1956..e1efe38 100644
--- a/test.py
+++ b/test.py
@@ -142,11 +142,36 @@ class TestSlugification(unittest.TestCase):
r = slugify(txt, stopwords=['the'], separator=' ')
self.assertEqual(r, 'quick brown fox jumps over lazy dog')
- def test_html_entities(self):
+ def test_html_entities_on(self):
txt = 'foo &amp; bar'
r = slugify(txt)
self.assertEqual(r, 'foo-bar')
+ def test_html_entities_off(self):
+ txt = 'foo &amp; bar'
+ r = slugify(txt, entities=False)
+ self.assertEqual(r, 'foo-amp-bar')
+
+ def test_html_decimal_on(self):
+ txt = '&#381;'
+ r = slugify(txt, decimal=True)
+ self.assertEqual(r, 'z')
+
+ def test_html_decimal_off(self):
+ txt = '&#381;'
+ r = slugify(txt, entities=False, decimal=False)
+ self.assertEqual(r, '381')
+
+ def test_html_hexadecimal_on(self):
+ txt = '&#x17D;'
+ r = slugify(txt, hexadecimal=True)
+ self.assertEqual(r, 'z')
+
+ def test_html_hexadecimal_off(self):
+ txt = '&#x17D;'
+ r = slugify(txt, hexadecimal=False)
+ self.assertEqual(r, 'x17d')
+
def test_starts_with_number(self):
txt = '10 amazing secrets'
r = slugify(txt)