aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_YoutubeDL.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-07-10 22:46:25 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-07-10 22:46:25 +0200
commit0a31a350981931ab9403d58258f5058ed98142a5 (patch)
tree6dee79aa2a6c541961a69e98b6d967d0aeb6bec7 /test/test_YoutubeDL.py
parentbb8e55366289e0c129ef85abb8c1ac1cbae86a66 (diff)
downloadyoutube-dl-0a31a350981931ab9403d58258f5058ed98142a5.zip
youtube-dl-0a31a350981931ab9403d58258f5058ed98142a5.tar.gz
youtube-dl-0a31a350981931ab9403d58258f5058ed98142a5.tar.bz2
[YoutubeDL] format spec: add additional checks for invalid syntax
Diffstat (limited to 'test/test_YoutubeDL.py')
-rw-r--r--test/test_YoutubeDL.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index bf2baae..20f45f4 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -302,6 +302,16 @@ class TestFormatSelection(unittest.TestCase):
downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], f1['format_id'])
+ def test_invalid_format_specs(self):
+ def assert_syntax_error(format_spec):
+ ydl = YDL({'format': format_spec})
+ info_dict = _make_result([{'format_id': 'foo', 'url': TEST_URL}])
+ self.assertRaises(SyntaxError, ydl.process_ie_result, info_dict)
+
+ assert_syntax_error('bestvideo,,best')
+ assert_syntax_error('+bestaudio')
+ assert_syntax_error('bestvideo+')
+
def test_format_filtering(self):
formats = [
{'format_id': 'A', 'filesize': 500, 'width': 1000},