aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-11-27 12:46:09 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-11-27 12:46:09 +0100
commit56781d3d2e476e2e109d0907d89548fd4da05058 (patch)
tree577de167abd61a1a59e6160ed419247ecc018ddb /test/test_utils.py
parented7516c69dbd676d0d98581756a483f19407fae4 (diff)
Switch back to underline for invalid characters, and make restricted ASCII-only
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 0a435ddc5..0b57e016c 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -22,10 +22,10 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename(u'123'), u'123')
- self.assertEqual(u'abc-de', sanitize_filename(u'abc/de'))
+ self.assertEqual(u'abc_de', sanitize_filename(u'abc/de'))
self.assertFalse(u'/' in sanitize_filename(u'abc/de///'))
- self.assertEqual(u'abc-de', sanitize_filename(u'abc/<>\\*|de'))
+ self.assertEqual(u'abc_de', sanitize_filename(u'abc/<>\\*|de'))
self.assertEqual(u'xxx', sanitize_filename(u'xxx/<>\\*|'))
self.assertEqual(u'yes no', sanitize_filename(u'yes? no'))
self.assertEqual(u'this - that', sanitize_filename(u'this: that'))
@@ -45,14 +45,17 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename(u'123', restricted=True), u'123')
- self.assertEqual(u'abc-de', sanitize_filename(u'abc/de', restricted=True))
+ self.assertEqual(u'abc_de', sanitize_filename(u'abc/de', restricted=True))
self.assertFalse(u'/' in sanitize_filename(u'abc/de///', restricted=True))
- self.assertEqual(u'abc-de', sanitize_filename(u'abc/<>\\*|de', restricted=True))
+ self.assertEqual(u'abc_de', sanitize_filename(u'abc/<>\\*|de', restricted=True))
self.assertEqual(u'xxx', sanitize_filename(u'xxx/<>\\*|', restricted=True))
self.assertEqual(u'yes_no', sanitize_filename(u'yes? no', restricted=True))
self.assertEqual(u'this_-_that', sanitize_filename(u'this: that', restricted=True))
+ self.assertEqual(sanitize_filename(u'aäb', restricted=True), u'a_b')
+ self.assertTrue(sanitize_filename(u'ö', restricted=True) != u'') # No empty filename
+
forbidden = u'"\0\\/&: \'\t\n'
for fc in forbidden:
print('input: ' + fc + ', result: ' + repr(sanitize_filename(fc, restricted=True)))