aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_text.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-08-29 02:17:16 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-08-29 02:17:16 -0400
commita768930761f7f20587ae40a8cacca0e55c85290a (patch)
tree5a4163db912b93fc45f717e5e43fd5be3e66f16c /test/test_text.py
parentae2a0f5622beaa6f402526f8a7b939419283a090 (diff)
New upstream version 1.23.0.upstream/1.23.0
Diffstat (limited to 'test/test_text.py')
-rw-r--r--test/test_text.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/test_text.py b/test/test_text.py
index ffed726..0ac7767 100644
--- a/test/test_text.py
+++ b/test/test_text.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# Copyright 2015-2021 Mike Fährmann
+# Copyright 2015-2022 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -75,6 +75,23 @@ class TestText(unittest.TestCase):
for value in INVALID:
self.assertEqual(f(value), empty)
+ def test_slugify(self, f=text.slugify):
+ self.assertEqual(f("Hello World"), "hello-world")
+ self.assertEqual(f("-HeLLo---World-"), "hello-world")
+ self.assertEqual(f("_-H#e:l#l:o+\t+W?o!rl=d-_"), "hello-world")
+ self.assertEqual(f("_Hello_World_"), "hello_world")
+
+ self.assertEqual(f(""), "")
+ self.assertEqual(f("-"), "")
+ self.assertEqual(f("--"), "")
+
+ self.assertEqual(f(()), "")
+ self.assertEqual(f([]), "")
+ self.assertEqual(f({}), "")
+ self.assertEqual(f(None), "none")
+ self.assertEqual(f(1), "1")
+ self.assertEqual(f(2.3), "23")
+
def test_ensure_http_scheme(self, f=text.ensure_http_scheme):
result = "https://example.org/filename.ext"