X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/bc5059672e222ec4df4fe3983c399c0d0fca84d5..63a6927374492ef47c8fd6de67d0760ace4dd0ed:/test/test_utils.py?ds=inline diff --git a/test/test_utils.py b/test/test_utils.py index e9e590e..e5778cd 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -13,19 +13,21 @@ import xml.etree.ElementTree #from youtube_dl.utils import htmlentity_transform from youtube_dl.utils import ( - timeconvert, - sanitize_filename, - unescapeHTML, - orderedSet, DateRange, - unified_strdate, + encodeFilename, find_xpath_attr, get_meta_content, - xpath_with_ns, + orderedSet, + sanitize_filename, + shell_quote, smuggle_url, + str_to_int, + timeconvert, + unescapeHTML, + unified_strdate, unsmuggle_url, - shell_quote, - encodeFilename, + url_basename, + xpath_with_ns, ) if sys.version_info < (3, 0): @@ -176,6 +178,19 @@ class TestUtil(unittest.TestCase): args = ['ffmpeg', '-i', encodeFilename(u'ñ€ß\'.mp4')] self.assertEqual(shell_quote(args), u"""ffmpeg -i 'ñ€ß'"'"'.mp4'""") + def test_str_to_int(self): + self.assertEqual(str_to_int('123,456'), 123456) + self.assertEqual(str_to_int('123.456'), 123456) + + def test_url_basename(self): + self.assertEqual(url_basename(u'http://foo.de/'), u'') + self.assertEqual(url_basename(u'http://foo.de/bar/baz'), u'baz') + self.assertEqual(url_basename(u'http://foo.de/bar/baz?x=y'), u'baz') + self.assertEqual(url_basename(u'http://foo.de/bar/baz#x=y'), u'baz') + self.assertEqual(url_basename(u'http://foo.de/bar/baz/'), u'baz') + self.assertEqual( + url_basename(u'http://media.w3.org/2010/05/sintel/trailer.mp4'), + u'trailer.mp4') if __name__ == '__main__': unittest.main()