Ejemplo n.º 1
0
def test_lambdastr_as_regular_function_numpy_imports(symbolic_vars):
    expr, y, a = symbolic_vars
    s = symb.string_lambdastr_as_function(expr,
                                          y,
                                          a,
                                          use_numpy=True,
                                          include_imports=True)
    assert "def calc_expression(y, a):\n" in s
    assert STR_AUX_TEST_NUMPY in s
    assert "import numpy" in s
Ejemplo n.º 2
0
def test_save_to_file_stringfied_function_expression(data_files_dir,
                                                     symbolic_vars):
    expr, y, a = symbolic_vars
    s = symb.string_lambdastr_as_function(expr, y)
    symb.save_function_string_to_file(s, str(data_files_dir.join("aow.py")))
Ejemplo n.º 3
0
def test_lambdastr_as_regular_function(symbolic_vars):
    expr, y, a = symbolic_vars
    s = symb.string_lambdastr_as_function(expr, y, a)
    assert "def calc_expression(y, a):\n" in s
    assert STR_AUX_TEST in s
Ejemplo n.º 4
0
def test_lambdastr_as_regular_function_v_simple_fun_numpy(symbolic_vars):
    v = sympy.symbols("v")
    expr = v**2 - 4 * v
    s = symb.string_lambdastr_as_function(expr, v, use_numpy=True)
    assert "def calc_expression(v):\n" in s
    assert "r = v**2 - 4*v" in s
Ejemplo n.º 5
0
def test_save_to_file_stringfied_function_expression_save_local(
        data_files_dir, symbolic_vars):
    expr, y, a = symbolic_vars
    s = symb.string_lambdastr_as_function(expr, y)
    symb.save_function_string_to_file(s)