From 71188bb67b182fc5549119693c494683d3b527d1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 23 Jul 2015 23:14:20 +0200 Subject: [PATCH] configtypes: Simplify UrlList tests. --- tests/config/test_configtypes.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/config/test_configtypes.py b/tests/config/test_configtypes.py index 8f0d756fe..0461a67c3 100644 --- a/tests/config/test_configtypes.py +++ b/tests/config/test_configtypes.py @@ -1562,15 +1562,18 @@ class TestUrlList: """Test UrlList.""" + TESTS = { + 'http://qutebrowser.org/': [QUrl('http://qutebrowser.org/')], + 'http://qutebrowser.org/,http://heise.de/': + [QUrl('http://qutebrowser.org/'), QUrl('http://heise.de/')], + '': None, + } + @pytest.fixture def klass(self): return configtypes.UrlList - @pytest.mark.parametrize('val', [ - 'http://www.qutebrowser.org/', - 'http://www.qutebrowser.org/,htpt://www.heise.de/', - '', - ]) + @pytest.mark.parametrize('val', TESTS) def test_validate_valid(self, klass, val): klass(none_ok=True).validate(val) @@ -1587,12 +1590,7 @@ class TestUrlList: with pytest.raises(configexc.ValidationError): klass().validate('foo,,bar') - @pytest.mark.parametrize('val, expected', [ - ('http://qutebrowser.org/', [QUrl('http://qutebrowser.org/')]), - ('http://qutebrowser.org/,http://heise.de/', - [QUrl('http://qutebrowser.org/'), QUrl('http://heise.de/')]), - ('', None), - ]) + @pytest.mark.parametrize('val, expected', TESTS.items()) def test_transform_single(self, klass, val, expected): assert klass().transform(val) == expected