[fix] float operations in calculator plugin

This patch adds an additional *isinstance* check within the ast parser to check
for float along with int, fixing the underlying issue.

Co-Authored: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Grant Lanham 2024-10-05 16:10:56 +02:00 committed by Markus Heiser
parent d448def1a6
commit 3e87354f0e
4 changed files with 51 additions and 16 deletions

View file

@ -1,12 +1,15 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import babel
from mock import Mock
from searx import plugins
from tests import SearxTestCase
def get_search_mock(query, **kwargs):
lang = kwargs.get("lang", "en-US")
kwargs["locale"] = babel.Locale.parse(lang, sep="-")
return Mock(search_query=Mock(query=query, **kwargs), result_container=Mock(answers={}))