configtypes: Simplify UrlList tests.
This commit is contained in:
parent
a558f666bc
commit
71188bb67b
@ -1562,15 +1562,18 @@ class TestUrlList:
|
|||||||
|
|
||||||
"""Test UrlList."""
|
"""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
|
@pytest.fixture
|
||||||
def klass(self):
|
def klass(self):
|
||||||
return configtypes.UrlList
|
return configtypes.UrlList
|
||||||
|
|
||||||
@pytest.mark.parametrize('val', [
|
@pytest.mark.parametrize('val', TESTS)
|
||||||
'http://www.qutebrowser.org/',
|
|
||||||
'http://www.qutebrowser.org/,htpt://www.heise.de/',
|
|
||||||
'',
|
|
||||||
])
|
|
||||||
def test_validate_valid(self, klass, val):
|
def test_validate_valid(self, klass, val):
|
||||||
klass(none_ok=True).validate(val)
|
klass(none_ok=True).validate(val)
|
||||||
|
|
||||||
@ -1587,12 +1590,7 @@ class TestUrlList:
|
|||||||
with pytest.raises(configexc.ValidationError):
|
with pytest.raises(configexc.ValidationError):
|
||||||
klass().validate('foo,,bar')
|
klass().validate('foo,,bar')
|
||||||
|
|
||||||
@pytest.mark.parametrize('val, expected', [
|
@pytest.mark.parametrize('val, expected', TESTS.items())
|
||||||
('http://qutebrowser.org/', [QUrl('http://qutebrowser.org/')]),
|
|
||||||
('http://qutebrowser.org/,http://heise.de/',
|
|
||||||
[QUrl('http://qutebrowser.org/'), QUrl('http://heise.de/')]),
|
|
||||||
('', None),
|
|
||||||
])
|
|
||||||
def test_transform_single(self, klass, val, expected):
|
def test_transform_single(self, klass, val, expected):
|
||||||
assert klass().transform(val) == expected
|
assert klass().transform(val) == expected
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user