aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_text.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-08-29 02:17:22 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-08-29 02:17:22 -0400
commitba3ac631ac4e8820d3d701980782ab4a03c1276b (patch)
tree06eecd8b697bf84e96d8347453bb66ba8689fc8b /test/test_text.py
parent011fcf09a56e256bc5d78bcbc629e6f6f76b053d (diff)
parenta768930761f7f20587ae40a8cacca0e55c85290a (diff)
Update upstream source from tag 'upstream/1.23.0'
Update to upstream version '1.23.0' with Debian dir 8809d3b22d175263b51492e17e8298cdd52f7af1
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"