aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-05-19 04:31:30 +0600
committerSergey M․ <dstftw@gmail.com>2016-05-19 04:31:30 +0600
commit46bc9b7d7cea2e161670e65abe42ef01d39e8957 (patch)
treeed0ae44e8dedebe282f8e2a06d8c97b67c69aae1 /test
parentb78531a36abd765aa9c9df1dba1cf82dc23f8fec (diff)
[utils] Allow None in remove_{start,end}
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 520d32ff5..a697232a8 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -50,6 +50,8 @@ from youtube_dl.utils import (
sanitize_path,
prepend_extension,
replace_extension,
+ remove_start,
+ remove_end,
remove_quotes,
shell_quote,
smuggle_url,
@@ -215,6 +217,16 @@ class TestUtil(unittest.TestCase):
self.assertEqual(replace_extension('.abc', 'temp'), '.abc.temp')
self.assertEqual(replace_extension('.abc.ext', 'temp'), '.abc.temp')
+ def test_remove_start(self):
+ self.assertEqual(remove_start(None, 'A - '), None)
+ self.assertEqual(remove_start('A - B', 'A - '), 'B')
+ self.assertEqual(remove_start('B - A', 'A - '), 'B - A')
+
+ def test_remove_end(self):
+ self.assertEqual(remove_end(None, ' - B'), None)
+ self.assertEqual(remove_end('A - B', ' - B'), 'A')
+ self.assertEqual(remove_end('B - A', ' - B'), 'B - A')
+
def test_remove_quotes(self):
self.assertEqual(remove_quotes(None), None)
self.assertEqual(remove_quotes('"'), '"')