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 PyQt5.QtCore import Qt, QModelIndex, QAbstractItemModel
|
||||||
|
|
||||||
from qutebrowser.utils import log, qtutils
|
from qutebrowser.utils import log, qtutils
|
||||||
from qutebrowser.commands import cmdexc
|
|
||||||
|
|
||||||
|
|
||||||
class CompletionModel(QAbstractItemModel):
|
class CompletionModel(QAbstractItemModel):
|
||||||
|
@ -92,7 +92,6 @@ def buffer():
|
|||||||
|
|
||||||
Used for switching the buffer command.
|
Used for switching the buffer command.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def delete_buffer(data):
|
def delete_buffer(data):
|
||||||
"""Close the selected tab."""
|
"""Close the selected tab."""
|
||||||
win_id, tab_index = data[0].split('/')
|
win_id, tab_index = data[0].split('/')
|
||||||
|
@ -27,7 +27,7 @@ import pytest
|
|||||||
from PyQt5.QtCore import QModelIndex
|
from PyQt5.QtCore import QModelIndex
|
||||||
|
|
||||||
from qutebrowser.completion.models import completionmodel, listcategory
|
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,
|
@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():
|
def test_delete_cur_item_no_cat():
|
||||||
"""Test completion_item_del with no selected category."""
|
"""Test completion_item_del with no selected category."""
|
||||||
model = completionmodel.CompletionModel()
|
model = completionmodel.CompletionModel()
|
||||||
with pytest.raises(cmdexc.CommandError, match='No category selected'):
|
with pytest.raises(qtutils.QtValueError):
|
||||||
model.delete_cur_item(QModelIndex())
|
model.delete_cur_item(QModelIndex())
|
||||||
|
@ -25,35 +25,26 @@ from helpers import utils
|
|||||||
from qutebrowser.completion.models import listcategory
|
from qutebrowser.completion.models import listcategory
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('pattern, filter_cols, before, after', [
|
@pytest.mark.parametrize('pattern, before, after', [
|
||||||
('foo', [0],
|
('foo',
|
||||||
[('foo', '', ''), ('bar', '', '')],
|
[('foo', ''), ('bar', '')],
|
||||||
[('foo', '', '')]),
|
[('foo', '')]),
|
||||||
|
|
||||||
('foo', [0],
|
('foo',
|
||||||
[('foob', '', ''), ('fooc', '', ''), ('fooa', '', '')],
|
[('foob', ''), ('fooc', ''), ('fooa', '')],
|
||||||
[('fooa', '', ''), ('foob', '', ''), ('fooc', '', '')]),
|
[('fooa', ''), ('foob', ''), ('fooc', '')]),
|
||||||
|
|
||||||
# prefer foobar as it starts with the pattern
|
# prefer foobar as it starts with the pattern
|
||||||
('foo', [0],
|
('foo',
|
||||||
[('barfoo', '', ''), ('foobar', '', '')],
|
[('barfoo', ''), ('foobar', '')],
|
||||||
[('foobar', '', ''), ('barfoo', '', '')]),
|
[('foobar', ''), ('barfoo', '')]),
|
||||||
|
|
||||||
('foo', [1],
|
('foo',
|
||||||
[('foo', 'bar', ''), ('bar', 'foo', '')],
|
[('foo', 'bar'), ('bar', 'foo'), ('bar', 'bar')],
|
||||||
[('bar', 'foo', '')]),
|
[('foo', 'bar'), ('bar', 'foo')]),
|
||||||
|
|
||||||
('foo', [0, 1],
|
|
||||||
[('foo', 'bar', ''), ('bar', 'foo', ''), ('bar', 'bar', '')],
|
|
||||||
[('foo', 'bar', ''), ('bar', 'foo', '')]),
|
|
||||||
|
|
||||||
('foo', [0, 1, 2],
|
|
||||||
[('foo', '', ''), ('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."""
|
"""Validate the filtering and sorting results of set_pattern."""
|
||||||
cat = listcategory.ListCategory('Foo', before,
|
cat = listcategory.ListCategory('Foo', before)
|
||||||
columns_to_filter=filter_cols)
|
|
||||||
cat.set_pattern(pattern)
|
cat.set_pattern(pattern)
|
||||||
utils.validate_model(cat, after)
|
utils.validate_model(cat, after)
|
||||||
|
Loading…
Reference in New Issue
Block a user