aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-05-02 23:23:06 +0600
committerSergey M․ <dstftw@gmail.com>2015-05-02 23:23:06 +0600
commitb3ed15b7604ce83e85b791ed329c5725a436b805 (patch)
treef10ae77994c6eaa011cdfb3be62f490e1d930dd1 /test
parent666a9a2b954bb6c75a5fcdb9fbb18842038c188a (diff)
[utils] Add replace_extension
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index a9464f2e4..6906a65c2 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -42,6 +42,7 @@ from youtube_dl.utils import (
sanitize_path,
sanitize_url_path_consecutive_slashes,
prepend_extension,
+ replace_extension,
shell_quote,
smuggle_url,
str_to_int,
@@ -202,6 +203,14 @@ class TestUtil(unittest.TestCase):
self.assertEqual(prepend_extension('.abc', 'temp'), '.abc.temp')
self.assertEqual(prepend_extension('.abc.ext', 'temp'), '.abc.temp.ext')
+ def test_replace_extension(self):
+ self.assertEqual(replace_extension('abc.ext', 'temp'), 'abc.temp')
+ self.assertEqual(replace_extension('abc.ext', 'temp', 'ext'), 'abc.temp')
+ self.assertEqual(replace_extension('abc.unexpected_ext', 'temp', 'ext'), 'abc.unexpected_ext.temp')
+ self.assertEqual(replace_extension('abc', 'temp'), 'abc.temp')
+ self.assertEqual(replace_extension('.abc', 'temp'), '.abc.temp')
+ self.assertEqual(replace_extension('.abc.ext', 'temp'), '.abc.temp')
+
def test_ordered_set(self):
self.assertEqual(orderedSet([1, 1, 2, 3, 4, 4, 5, 6, 7, 3, 5]), [1, 2, 3, 4, 5, 6, 7])
self.assertEqual(orderedSet([]), [])