Exemplo n.º 1
0
def test_string_vs_ast():
    expression = "2 * (3 + 4)"
    parsed = parser.parse(expression)
    assert evaljs(expression) == evaljs(parsed)
Exemplo n.º 2
0
def test_expressions(expression, names):
    assert eval(expression, names) == evaljs(expression, names)
Exemplo n.º 3
0
def test_jsonly_expressions(expression, output, names):
    assert evaljs(expression, names) == output
Exemplo n.º 4
0
def eval_vegajs(expression: str, datum: ibis.Expr = None) -> ibis.Expr:
    """Evaluate a vega expression"""
    namespace = {"datum": datum} if datum is not None else {}
    namespace.update(VEGAJS_NAMESPACE)
    return evaljs(expression, namespace)