Only keep contain tests
This commit is contained in:
parent
65ed878dcf
commit
f49cc4e901
@ -24,48 +24,16 @@ import pytest
|
|||||||
from qutebrowser.completion.models import base, sortfilter
|
from qutebrowser.completion.models import base, sortfilter
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('match_type, pattern, data, expected', [
|
@pytest.mark.parametrize('pattern, data, expected', [
|
||||||
('contain', 'foo', 'barfoobar', True),
|
('foo', 'barfoobar', True),
|
||||||
('contain', 'foo', 'barFOObar', True),
|
('foo', 'barFOObar', True),
|
||||||
('contain', 'Foo', 'barfOObar', True),
|
('Foo', 'barfOObar', True),
|
||||||
('contain', 'ab', 'aonebtwo', False),
|
('ab', 'aonebtwo', False),
|
||||||
('contain', '33', 'l33t', True),
|
('33', 'l33t', True),
|
||||||
('contain', 'x', 'blah', False),
|
('x', 'blah', False),
|
||||||
('contain', '4', 'blah', False),
|
('4', 'blah', False),
|
||||||
|
|
||||||
('fuzzy', 'foo', 'barfoobar', True),
|
|
||||||
('fuzzy', 'foo', 'barFoObar', True),
|
|
||||||
('fuzzy', 'fOO', 'barFoobar', True),
|
|
||||||
('fuzzy', 'ab', 'aonebtwo', True),
|
|
||||||
('fuzzy', 'abb', 'aonebtwo', True),
|
|
||||||
('fuzzy', 'abb', 'aonebtwob', True),
|
|
||||||
('fuzzy', 'abeb', 'aonebtwo', False),
|
|
||||||
('fuzzy', 'dore', 'download-remove', True),
|
|
||||||
('fuzzy', 'dorn', 'download-remove', False),
|
|
||||||
('fuzzy', 'x', 'blah', False),
|
|
||||||
('fuzzy', '14', 'bar1234Foobar', True),
|
|
||||||
('fuzzy', '14', 'bar3Foobar', False),
|
|
||||||
('fuzzy', 'ab', 'boneatwo', False),
|
|
||||||
('fuzzy', '/?', 'http://00hta.com', False),
|
|
||||||
|
|
||||||
('start', 'foo', 'foobar', True),
|
|
||||||
('start', '1oo', '1oobar', True),
|
|
||||||
('start', '1oo', '2arfoobar', False),
|
|
||||||
('start', 'foo', 'Foobar', True),
|
|
||||||
('start', 'Foo', 'foobar', True),
|
|
||||||
('start', 'foo', 'barfoobar', False),
|
|
||||||
('start', 'foo', 'barfoo', False),
|
|
||||||
('start', 'ab', 'aonebtwo', False),
|
|
||||||
('start', 'x', 'blah', False),
|
|
||||||
('start', 'ht', 'http://a.com', False),
|
|
||||||
('start', 'ht', 'http://aht.com', False),
|
|
||||||
('start', '11', 'http://aht.com', False),
|
|
||||||
('start', 'ht', 'http://hta.com', True),
|
|
||||||
('start', '00', 'http://00hta.com', True),
|
|
||||||
])
|
])
|
||||||
def test_filter_accepts_row(config_stub, match_type, pattern, data, expected):
|
def test_filter_accepts_row(pattern, data, expected):
|
||||||
config_stub.data = {'completion': {'match-type': match_type}}
|
|
||||||
|
|
||||||
source_model = base.BaseCompletionModel()
|
source_model = base.BaseCompletionModel()
|
||||||
cat = source_model.new_category('test')
|
cat = source_model.new_category('test')
|
||||||
source_model.new_item(cat, data)
|
source_model.new_item(cat, data)
|
||||||
|
Loading…
Reference in New Issue
Block a user