aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_youtube_misc.py
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2021-04-21 04:45:13 +0700
committerSergey M․ <[email protected]>2021-04-21 04:45:13 +0700
commit5ad69d3d0e7d1d8d15a1f2497d602b1b91fcc74a (patch)
tree8a8c79d58b1108d73442a8da070d1e96702eff33 /test/test_youtube_misc.py
parent32290307a45260885b2210aa3c2a57e64abf8c34 (diff)
downloadyoutube-dl-5ad69d3d0e7d1d8d15a1f2497d602b1b91fcc74a.tar.gz
youtube-dl-5ad69d3d0e7d1d8d15a1f2497d602b1b91fcc74a.zip
[test_youtube_misc] Move YoutubeIE.extract_id test into separate module
Diffstat (limited to 'test/test_youtube_misc.py')
-rw-r--r--test/test_youtube_misc.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_youtube_misc.py b/test/test_youtube_misc.py
new file mode 100644
index 000000000..e18e71101
--- /dev/null
+++ b/test/test_youtube_misc.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+from __future__ import unicode_literals
+
+# Allow direct execution
+import os
+import sys
+import unittest
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+
+from youtube_dl.extractor import YoutubeIE
+
+
+class TestYoutubeMisc(unittest.TestCase):
+ def test_youtube_extract(self):
+ assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)
+ assertExtractId('http://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
+ assertExtractId('https://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
+ assertExtractId('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc', 'BaW_jenozKc')
+ assertExtractId('https://www.youtube.com/watch_popup?v=BaW_jenozKc', 'BaW_jenozKc')
+ assertExtractId('http://www.youtube.com/watch?v=BaW_jenozKcsharePLED17F32AD9753930', 'BaW_jenozKc')
+ assertExtractId('BaW_jenozKc', 'BaW_jenozKc')
+
+
+if __name__ == '__main__':
+ unittest.main()