mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[mod] pylint: numerous minor code fixes
This commit is contained in:
parent
9ed3ee2beb
commit
b00d108673
24 changed files with 48 additions and 64 deletions
|
|
@ -31,10 +31,10 @@ class PluginStoreTest(SearxTestCase):
|
|||
request = Mock()
|
||||
store.call([], 'asdf', request, Mock())
|
||||
|
||||
self.assertFalse(testplugin.asdf.called)
|
||||
self.assertFalse(testplugin.asdf.called) # pylint: disable=E1101
|
||||
|
||||
store.call([testplugin], 'asdf', request, Mock())
|
||||
self.assertTrue(testplugin.asdf.called)
|
||||
self.assertTrue(testplugin.asdf.called) # pylint: disable=E1101
|
||||
|
||||
|
||||
class SelfIPTest(SearxTestCase):
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from searx.testing import SearxTestCase
|
|||
|
||||
class PluginStub:
|
||||
|
||||
def __init__(self, id, default_on):
|
||||
self.id = id
|
||||
def __init__(self, plugin_id, default_on):
|
||||
self.id = plugin_id
|
||||
self.default_on = default_on
|
||||
|
||||
|
||||
|
|
@ -15,11 +15,11 @@ class TestSettings(SearxTestCase):
|
|||
|
||||
def test_map_setting_invalid_initialization(self):
|
||||
with self.assertRaises(MissingArgumentException):
|
||||
setting = MapSetting(3, wrong_argument={'0': 0})
|
||||
MapSetting(3, wrong_argument={'0': 0})
|
||||
|
||||
def test_map_setting_invalid_default_value(self):
|
||||
with self.assertRaises(ValidationException):
|
||||
setting = MapSetting(3, map={'dog': 1, 'bat': 2})
|
||||
MapSetting(3, map={'dog': 1, 'bat': 2})
|
||||
|
||||
def test_map_setting_invalid_choice(self):
|
||||
setting = MapSetting(2, map={'dog': 1, 'bat': 2})
|
||||
|
|
@ -36,18 +36,14 @@ class TestSettings(SearxTestCase):
|
|||
setting.parse('bat')
|
||||
self.assertEqual(setting.get_value(), 2)
|
||||
|
||||
def test_enum_setting_invalid_initialization(self):
|
||||
with self.assertRaises(MissingArgumentException):
|
||||
setting = EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
||||
|
||||
# enum settings
|
||||
def test_enum_setting_invalid_initialization(self):
|
||||
with self.assertRaises(MissingArgumentException):
|
||||
setting = EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
||||
EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
||||
|
||||
def test_enum_setting_invalid_default_value(self):
|
||||
with self.assertRaises(ValidationException):
|
||||
setting = EnumStringSetting(3, choices=[0, 1, 2])
|
||||
EnumStringSetting(3, choices=[0, 1, 2])
|
||||
|
||||
def test_enum_setting_invalid_choice(self):
|
||||
setting = EnumStringSetting(0, choices=[0, 1, 2])
|
||||
|
|
@ -67,11 +63,11 @@ class TestSettings(SearxTestCase):
|
|||
# multiple choice settings
|
||||
def test_multiple_setting_invalid_initialization(self):
|
||||
with self.assertRaises(MissingArgumentException):
|
||||
setting = MultipleChoiceSetting(['2'], wrong_argument=['0', '1', '2'])
|
||||
MultipleChoiceSetting(['2'], wrong_argument=['0', '1', '2'])
|
||||
|
||||
def test_multiple_setting_invalid_default_value(self):
|
||||
with self.assertRaises(ValidationException):
|
||||
setting = MultipleChoiceSetting(['3', '4'], choices=['0', '1', '2'])
|
||||
MultipleChoiceSetting(['3', '4'], choices=['0', '1', '2'])
|
||||
|
||||
def test_multiple_setting_invalid_choice(self):
|
||||
setting = MultipleChoiceSetting(['1', '2'], choices=['0', '1', '2'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue