diff options
author | Nicholas Schwab <git@nicholas-schwab.de> | 2021-04-08 16:29:54 +0200 |
---|---|---|
committer | Nicholas Schwab <git@nicholas-schwab.de> | 2021-04-08 16:29:54 +0200 |
commit | 8cb5a123d1ea8e6b58de1a50705eb5be16553c30 (patch) | |
tree | 8971928f35f6cb69935b07727a9877e68ba19499 | |
parent | 895d28e0303a17130003e8604a948e7c93fdbcbe (diff) | |
download | qutebrowser-8cb5a123d1ea8e6b58de1a50705eb5be16553c30.tar.gz qutebrowser-8cb5a123d1ea8e6b58de1a50705eb5be16553c30.zip |
Added tests for configtypes.PrefixOrString.
-rw-r--r-- | tests/unit/config/test_configtypes.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 22674c812..158150886 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -2204,6 +2204,23 @@ class TestUrlPattern: klass().to_py('http://') +class TestPrefixOrString: + + @pytest.fixture + def klass(self): + return configtypes.PrefixOrString + + def test_to_py_valid(self, klass): + widget = klass() + widget.valid_values = configtypes.ValidValues('foo') + widget.valid_prefixes = configtypes.ValidPrefixes('bar') + + patterns = ['foo', 'bar:baz'] + + for i in patterns: + assert i == widget.to_py(i) + + @pytest.mark.parametrize('first, second, equal', [ (re.compile('foo'), RegexEq('foo'), True), (RegexEq('bar'), re.compile('bar'), True), |