change unresponsive_engines to a set to eliminate duplication of errors

This commit is contained in:
Noémi Ványi 2017-07-19 17:23:54 +02:00 committed by Adam Tauber
parent c30f73f8fd
commit 2242000bd4
2 changed files with 4 additions and 4 deletions

View File

@ -135,7 +135,7 @@ class ResultContainer(object):
self._number_of_results = [] self._number_of_results = []
self._ordered = False self._ordered = False
self.paging = False self.paging = False
self.unresponsive_engines = [] self.unresponsive_engines = set()
def extend(self, engine_name, results): def extend(self, engine_name, results):
for result in list(results): for result in list(results):
@ -306,5 +306,5 @@ class ResultContainer(object):
return 0 return 0
return resultnum_sum / len(self._number_of_results) return resultnum_sum / len(self._number_of_results)
def add_unresponsive_engine(self, engine_name): def add_unresponsive_engine(self, engine_error):
self.unresponsive_engines.append(engine_name) self.unresponsive_engines.add(engine_error)

View File

@ -39,7 +39,7 @@ class ViewsTestCase(SearxTestCase):
corrections=set(), corrections=set(),
suggestions=set(), suggestions=set(),
infoboxes=[], infoboxes=[],
unresponsive_engines=[], unresponsive_engines=set(),
results=self.test_results, results=self.test_results,
results_number=lambda: 3, results_number=lambda: 3,
results_length=lambda: len(self.test_results)) results_length=lambda: len(self.test_results))