summaryrefslogtreecommitdiff
path: root/tests/unit/test_preferences.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_preferences.py')
-rw-r--r--tests/unit/test_preferences.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/unit/test_preferences.py b/tests/unit/test_preferences.py
index 61ac0e8e4..32f50c60b 100644
--- a/tests/unit/test_preferences.py
+++ b/tests/unit/test_preferences.py
@@ -3,7 +3,7 @@ from searx.preferences import (EnumStringSetting, MapSetting, MissingArgumentExc
from searx.testing import SearxTestCase
-class PluginStub(object):
+class PluginStub:
def __init__(self, id, default_on):
self.id = id
@@ -28,13 +28,13 @@ class TestSettings(SearxTestCase):
def test_map_setting_valid_default(self):
setting = MapSetting(3, map={'dog': 1, 'bat': 2, 'cat': 3})
- self.assertEquals(setting.get_value(), 3)
+ self.assertEqual(setting.get_value(), 3)
def test_map_setting_valid_choice(self):
setting = MapSetting(3, map={'dog': 1, 'bat': 2, 'cat': 3})
- self.assertEquals(setting.get_value(), 3)
+ self.assertEqual(setting.get_value(), 3)
setting.parse('bat')
- self.assertEquals(setting.get_value(), 2)
+ self.assertEqual(setting.get_value(), 2)
def test_enum_setting_invalid_initialization(self):
with self.assertRaises(MissingArgumentException):
@@ -56,13 +56,13 @@ class TestSettings(SearxTestCase):
def test_enum_setting_valid_default(self):
setting = EnumStringSetting(3, choices=[1, 2, 3])
- self.assertEquals(setting.get_value(), 3)
+ self.assertEqual(setting.get_value(), 3)
def test_enum_setting_valid_choice(self):
setting = EnumStringSetting(3, choices=[1, 2, 3])
- self.assertEquals(setting.get_value(), 3)
+ self.assertEqual(setting.get_value(), 3)
setting.parse(2)
- self.assertEquals(setting.get_value(), 2)
+ self.assertEqual(setting.get_value(), 2)
# multiple choice settings
def test_multiple_setting_invalid_initialization(self):
@@ -80,48 +80,48 @@ class TestSettings(SearxTestCase):
def test_multiple_setting_valid_default(self):
setting = MultipleChoiceSetting(['3'], choices=['1', '2', '3'])
- self.assertEquals(setting.get_value(), ['3'])
+ self.assertEqual(setting.get_value(), ['3'])
def test_multiple_setting_valid_choice(self):
setting = MultipleChoiceSetting(['3'], choices=['1', '2', '3'])
- self.assertEquals(setting.get_value(), ['3'])
+ self.assertEqual(setting.get_value(), ['3'])
setting.parse('2')
- self.assertEquals(setting.get_value(), ['2'])
+ self.assertEqual(setting.get_value(), ['2'])
# search language settings
def test_lang_setting_valid_choice(self):
setting = SearchLanguageSetting('all', choices=['all', 'de', 'en'])
setting.parse('de')
- self.assertEquals(setting.get_value(), 'de')
+ self.assertEqual(setting.get_value(), 'de')
def test_lang_setting_invalid_choice(self):
setting = SearchLanguageSetting('all', choices=['all', 'de', 'en'])
setting.parse('xx')
- self.assertEquals(setting.get_value(), 'all')
+ self.assertEqual(setting.get_value(), 'all')
def test_lang_setting_old_cookie_choice(self):
setting = SearchLanguageSetting('all', choices=['all', 'es', 'es-ES'])
setting.parse('es_XA')
- self.assertEquals(setting.get_value(), 'es')
+ self.assertEqual(setting.get_value(), 'es')
def test_lang_setting_old_cookie_format(self):
setting = SearchLanguageSetting('all', choices=['all', 'es', 'es-ES'])
setting.parse('es_ES')
- self.assertEquals(setting.get_value(), 'es-ES')
+ self.assertEqual(setting.get_value(), 'es-ES')
# plugins settings
def test_plugins_setting_all_default_enabled(self):
plugin1 = PluginStub('plugin1', True)
plugin2 = PluginStub('plugin2', True)
setting = PluginsSetting(['3'], choices=[plugin1, plugin2])
- self.assertEquals(setting.get_enabled(), set(['plugin1', 'plugin2']))
+ self.assertEqual(setting.get_enabled(), set(['plugin1', 'plugin2']))
def test_plugins_setting_few_default_enabled(self):
plugin1 = PluginStub('plugin1', True)
plugin2 = PluginStub('plugin2', False)
plugin3 = PluginStub('plugin3', True)
setting = PluginsSetting('name', choices=[plugin1, plugin2, plugin3])
- self.assertEquals(setting.get_enabled(), set(['plugin1', 'plugin3']))
+ self.assertEqual(setting.get_enabled(), set(['plugin1', 'plugin3']))
class TestPreferences(SearxTestCase):