diff --git a/redash/query_runner/python.py b/redash/query_runner/python.py index 544cd593d..83e135bf4 100644 --- a/redash/query_runner/python.py +++ b/redash/query_runner/python.py @@ -53,31 +53,31 @@ class Python(BaseQueryRunner): should_annotate_query = False safe_builtins = ( - "sorted", - "reversed", - "map", - "any", - "all", - "slice", - "filter", - "len", - "next", - "enumerate", - "sum", "abs", - "min", - "max", - "round", - "divmod", - "str", - "int", - "float", - "complex", - "tuple", - "set", - "list", - "dict", + "all", + "any", "bool", + "complex", + "dict", + "divmod", + "enumerate", + "filter", + "float", + "int", + "len", + "list", + "map", + "max", + "min", + "next", + "reversed", + "round", + "set", + "slice", + "sorted", + "str", + "sum", + "tuple", ) @classmethod diff --git a/tests/query_runner/test_python.py b/tests/query_runner/test_python.py new file mode 100644 index 000000000..a587c6864 --- /dev/null +++ b/tests/query_runner/test_python.py @@ -0,0 +1,9 @@ +from unittest import TestCase + +from redash.query_runner.python import Python + + +class TestPython(TestCase): + def test_sorted_safe_builtins(self): + src = list(Python.safe_builtins) + assert src == sorted(src), 'Python safe_builtins package not sorted.'