diff options
author | Alexandre Flament <alex@al-f.net> | 2020-11-16 09:43:23 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-12-01 15:21:19 +0100 |
commit | b00d108673082fc2487b2d122db00d988f561427 (patch) | |
tree | 51b5324935f24864730d705efd9f4f6a9dea465f /tests | |
parent | 9ed3ee2bebf2f159d4231d9aad9df53aea6db90a (diff) | |
download | searxng-b00d108673082fc2487b2d122db00d988f561427.tar.gz searxng-b00d108673082fc2487b2d122db00d988f561427.zip |
[mod] pylint: numerous minor code fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_plugins.py | 4 | ||||
-rw-r--r-- | tests/unit/test_preferences.py | 20 |
2 files changed, 10 insertions, 14 deletions
diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py index 969630c40..9ef4cd692 100644 --- a/tests/unit/test_plugins.py +++ b/tests/unit/test_plugins.py @@ -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): diff --git a/tests/unit/test_preferences.py b/tests/unit/test_preferences.py index bee436027..510d4985a 100644 --- a/tests/unit/test_preferences.py +++ b/tests/unit/test_preferences.py @@ -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']) |