mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-28 03:33:22 +08:00
test for multiple --reject-title and --match-title options
This commit is contained in:
parent
2c72a8b489
commit
bd05b7fd4c
28
test/test_options.py
Normal file
28
test/test_options.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/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 itertools import repeat
|
||||
|
||||
from youtube_dl.options import parseOpts
|
||||
|
||||
URL = 'someurl'
|
||||
|
||||
class TestOptions(unittest.TestCase):
|
||||
|
||||
def test_multiple_titles(self):
|
||||
# test that parser will accept multiple reject-title and match-title options
|
||||
regexes = ['regex' + i for i in map(str, range(10))]
|
||||
for name in ['reject', 'match']:
|
||||
options = [x for opts in zip(repeat('--' + name + '-title'), regexes) for x in opts]
|
||||
parser, opts, args = parseOpts(options + [URL])
|
||||
self.assertEqual(getattr(opts, name + 'title'), regexes)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user