From bd05b7fd4cef4f0b6834d2dac0d4817e0ec1d4d3 Mon Sep 17 00:00:00 2001 From: Carl Harris Date: Tue, 1 Dec 2015 17:50:08 -0500 Subject: [PATCH] test for multiple --reject-title and --match-title options --- test/test_options.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/test_options.py diff --git a/test/test_options.py b/test/test_options.py new file mode 100644 index 000000000..7cde7e085 --- /dev/null +++ b/test/test_options.py @@ -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()