Ejemplo n.º 1
0
def test_safe_proxy_nested_lambda(app_context: AppContext) -> None:
    def func(input_: Any) -> Any:
        return input_

    with pytest.raises(SupersetTemplateException):
        safe_proxy(func, {"foo": lambda: "bar"})
Ejemplo n.º 2
0
def test_safe_proxy_primitive(app_context: AppContext) -> None:
    def func(input_: Any) -> Any:
        return input_

    assert safe_proxy(func, "foo") == "foo"
Ejemplo n.º 3
0
def test_safe_proxy_dict(app_context: AppContext) -> None:
    def func(input_: Any) -> Any:
        return input_

    assert safe_proxy(func, {"foo": "bar"}) == {"foo": "bar"}
Ejemplo n.º 4
0
    def test_safe_proxy_nested_lambda(self) -> None:
        def func(input: Any) -> Any:
            return input

        with pytest.raises(SupersetTemplateException):
            safe_proxy(func, {"foo": lambda: "bar"})
Ejemplo n.º 5
0
    def test_safe_proxy_dict(self) -> None:
        def func(input: Any) -> Any:
            return input

        return_value = safe_proxy(func, {"foo": "bar"})
        self.assertEqual({"foo": "bar"}, return_value)
Ejemplo n.º 6
0
    def test_safe_proxy_primitive(self) -> None:
        def func(input: Any) -> Any:
            return input

        return_value = safe_proxy(func, "foo")
        self.assertEqual("foo", return_value)
Ejemplo n.º 7
0
def test_safe_proxy_lambda() -> None:
    def func(input_: Any) -> Any:
        return input_

    with pytest.raises(SupersetTemplateException):
        safe_proxy(func, lambda: "bar")
Ejemplo n.º 8
0
def test_safe_proxy_primitive() -> None:
    def func(input_: Any) -> Any:
        return input_

    assert safe_proxy(func, "foo") == "foo"