diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-05-02 23:10:48 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-05-02 23:10:48 +0600 |
commit | a4bcaad77314c714d2304cb21ffdd87a9b84316b (patch) | |
tree | 67f00332e0af8e97ee62a5f19991923077d1ba24 | |
parent | e65e4c88748f2d245aa683116a2c6de907186751 (diff) |
[test_utils] Add tests for prepend_extension
-rw-r--r-- | test/test_utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 17017a8c0..a9464f2e4 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -41,6 +41,7 @@ from youtube_dl.utils import ( sanitize_filename, sanitize_path, sanitize_url_path_consecutive_slashes, + prepend_extension, shell_quote, smuggle_url, str_to_int, @@ -193,6 +194,14 @@ class TestUtil(unittest.TestCase): sanitize_url_path_consecutive_slashes('http://hostname/abc//'), 'http://hostname/abc/') + def test_prepend_extension(self): + self.assertEqual(prepend_extension('abc.ext', 'temp'), 'abc.temp.ext') + self.assertEqual(prepend_extension('abc.ext', 'temp', 'ext'), 'abc.temp.ext') + self.assertEqual(prepend_extension('abc.unexpected_ext', 'temp', 'ext'), 'abc.unexpected_ext.temp') + self.assertEqual(prepend_extension('abc', 'temp'), 'abc.temp') + self.assertEqual(prepend_extension('.abc', 'temp'), '.abc.temp') + self.assertEqual(prepend_extension('.abc.ext', 'temp'), '.abc.temp.ext') + 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([]), []) |