diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-04-10 09:17:59 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-04-10 09:17:59 +0200 |
commit | 52708364b5f91e198defb022d1a5b4b3ebd9b563 (patch) | |
tree | f6d31841ae02b545431ff343878c63a570a8b9a0 /tests | |
parent | a0710124a1790237aa4f2a17e2f7011a074143b4 (diff) | |
parent | 9a836e2ca1dcf2a46cc6f72e76e6de68cf8c41fe (diff) | |
download | qutebrowser-52708364b5f91e198defb022d1a5b4b3ebd9b563.tar.gz qutebrowser-52708364b5f91e198defb022d1a5b4b3ebd9b563.zip |
Merge commit '9a836e2'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/config/test_configtypes.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 28c52a1e0..3e1d15099 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -2117,6 +2117,24 @@ class TestUrlPattern: klass().to_py('http://') +class TestStatusbarWidget: + + @pytest.fixture + def klass(self): + return configtypes.StatusbarWidget + + @pytest.mark.parametrize('value', ['text:bar', 'foo']) + def test_validate_valid_values(self, klass, value): + widget = klass(valid_values=configtypes.ValidValues('foo')) + assert widget.to_py(value) == value + + @pytest.mark.parametrize('value', ['text', 'foo:bar']) + def test_validate_invalid_values(self, klass, value): + widget = klass(valid_values=configtypes.ValidValues('foo')) + with pytest.raises(configexc.ValidationError): + widget.to_py(value) + + @pytest.mark.parametrize('first, second, equal', [ (re.compile('foo'), RegexEq('foo'), True), (RegexEq('bar'), re.compile('bar'), True), |