Skip to content

Commit

Permalink
[test_utils] Add tests for prepend_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed May 2, 2015
1 parent e65e4c8 commit a4bcaad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
sanitize_filename,
sanitize_path,
sanitize_url_path_consecutive_slashes,
prepend_extension,
shell_quote,
smuggle_url,
str_to_int,
Expand Down Expand Up @@ -193,6 +194,14 @@ def test_sanitize_url_path_consecutive_slashes(self):
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([]), [])
Expand Down

0 comments on commit a4bcaad

Please sign in to comment.