about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2022-11-01 21:33:39 +0000
committerGitHub <noreply@github.com>2022-11-01 21:33:39 +0000
commit65ccb0dd4eb52cced7d0e11af021c09dbe2aed4a (patch)
tree77cc1063764f6b69ffaa652a0b4f5aa4c2b2aaa7 /test
parenta874871801b8b05d06e8ffe52bed94fdfc26611e (diff)
downloadyoutube-dl-65ccb0dd4eb52cced7d0e11af021c09dbe2aed4a.tar.gz
youtube-dl-65ccb0dd4eb52cced7d0e11af021c09dbe2aed4a.tar.xz
youtube-dl-65ccb0dd4eb52cced7d0e11af021c09dbe2aed4a.zip
[compat] Add test for compat_casefold()
Diffstat (limited to 'test')
-rw-r--r--test/test_compat.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/test_compat.py b/test/test_compat.py
index 86ff389fd..05995372a 100644
--- a/test/test_compat.py
+++ b/test/test_compat.py
@@ -118,9 +118,21 @@ class TestCompat(unittest.TestCase):
 <smil xmlns="http://www.w3.org/2001/SMIL20/Language"></smil>'''
         compat_etree_fromstring(xml)
 
-    def test_struct_unpack(self):
+    def test_compat_struct_unpack(self):
         self.assertEqual(compat_struct_unpack('!B', b'\x00'), (0,))
 
+    def test_compat_casefold(self):
+        if hasattr(compat_str, 'casefold'):
+            # don't bother to test str.casefold() (again)
+            return
+        # thanks https://bugs.python.org/file24232/casefolding.patch
+        self.assertEqual(compat_casefold('hello'), 'hello')
+        self.assertEqual(compat_casefold('hELlo'), 'hello')
+        self.assertEqual(compat_casefold('ß'), 'ss')
+        self.assertEqual(compat_casefold('fi'), 'fi')
+        self.assertEqual(compat_casefold('\u03a3'), '\u03c3')
+        self.assertEqual(compat_casefold('A\u0345\u03a3'), 'a\u03b9\u03c3')
+
 
 if __name__ == '__main__':
     unittest.main()