Fix various test/flake8/pylint errors.
This commit is contained in:
parent
f2dbff92f4
commit
a34df34208
@ -22,7 +22,6 @@
|
||||
from PyQt5.QtCore import Qt, QModelIndex, QAbstractItemModel
|
||||
|
||||
from qutebrowser.utils import log, qtutils
|
||||
from qutebrowser.commands import cmdexc
|
||||
|
||||
|
||||
class CompletionModel(QAbstractItemModel):
|
||||
|
@ -92,7 +92,6 @@ def buffer():
|
||||
|
||||
Used for switching the buffer command.
|
||||
"""
|
||||
|
||||
def delete_buffer(data):
|
||||
"""Close the selected tab."""
|
||||
win_id, tab_index = data[0].split('/')
|
||||
|
@ -27,7 +27,7 @@ import pytest
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
|
||||
from qutebrowser.completion.models import completionmodel, listcategory
|
||||
from qutebrowser.commands import cmdexc
|
||||
from qutebrowser.utils import qtutils
|
||||
|
||||
|
||||
@hypothesis.given(strategies.lists(min_size=0, max_size=3,
|
||||
@ -91,5 +91,5 @@ def test_delete_cur_item():
|
||||
def test_delete_cur_item_no_cat():
|
||||
"""Test completion_item_del with no selected category."""
|
||||
model = completionmodel.CompletionModel()
|
||||
with pytest.raises(cmdexc.CommandError, match='No category selected'):
|
||||
with pytest.raises(qtutils.QtValueError):
|
||||
model.delete_cur_item(QModelIndex())
|
||||
|
@ -25,35 +25,26 @@ from helpers import utils
|
||||
from qutebrowser.completion.models import listcategory
|
||||
|
||||
|
||||
@pytest.mark.parametrize('pattern, filter_cols, before, after', [
|
||||
('foo', [0],
|
||||
[('foo', '', ''), ('bar', '', '')],
|
||||
[('foo', '', '')]),
|
||||
@pytest.mark.parametrize('pattern, before, after', [
|
||||
('foo',
|
||||
[('foo', ''), ('bar', '')],
|
||||
[('foo', '')]),
|
||||
|
||||
('foo', [0],
|
||||
[('foob', '', ''), ('fooc', '', ''), ('fooa', '', '')],
|
||||
[('fooa', '', ''), ('foob', '', ''), ('fooc', '', '')]),
|
||||
('foo',
|
||||
[('foob', ''), ('fooc', ''), ('fooa', '')],
|
||||
[('fooa', ''), ('foob', ''), ('fooc', '')]),
|
||||
|
||||
# prefer foobar as it starts with the pattern
|
||||
('foo', [0],
|
||||
[('barfoo', '', ''), ('foobar', '', '')],
|
||||
[('foobar', '', ''), ('barfoo', '', '')]),
|
||||
('foo',
|
||||
[('barfoo', ''), ('foobar', '')],
|
||||
[('foobar', ''), ('barfoo', '')]),
|
||||
|
||||
('foo', [1],
|
||||
[('foo', 'bar', ''), ('bar', 'foo', '')],
|
||||
[('bar', 'foo', '')]),
|
||||
|
||||
('foo', [0, 1],
|
||||
[('foo', 'bar', ''), ('bar', 'foo', ''), ('bar', 'bar', '')],
|
||||
[('foo', 'bar', ''), ('bar', 'foo', '')]),
|
||||
|
||||
('foo', [0, 1, 2],
|
||||
[('foo', '', ''), ('bar', '')],
|
||||
[('foo', '', '')]),
|
||||
('foo',
|
||||
[('foo', 'bar'), ('bar', 'foo'), ('bar', 'bar')],
|
||||
[('foo', 'bar'), ('bar', 'foo')]),
|
||||
])
|
||||
def test_set_pattern(pattern, filter_cols, before, after):
|
||||
def test_set_pattern(pattern, before, after):
|
||||
"""Validate the filtering and sorting results of set_pattern."""
|
||||
cat = listcategory.ListCategory('Foo', before,
|
||||
columns_to_filter=filter_cols)
|
||||
cat = listcategory.ListCategory('Foo', before)
|
||||
cat.set_pattern(pattern)
|
||||
utils.validate_model(cat, after)
|
||||
|
Loading…
Reference in New Issue
Block a user