Ejemplo n.º 1
0
def test_merge_func_code_skip_prefix():
    funccode, _ = merge_func_code(f,
                                  f2,
                                  prefix=["f_", "g_"],
                                  skip_first=True,
                                  skip_prefix=["z"])
    assert funccode.co_varnames == ("x", "f_y", "z", "g_a")
Ejemplo n.º 2
0
def test_merge_func_code_skip_prefix():
    funccode, pos = merge_func_code(
                                f, f2,
                                prefix=['f_', 'g_'],
                                skip_first=True,
                                skip_prefix=['z'])
    assert_equal(funccode.co_varnames, ('x', 'f_y', 'z', 'g_a'))
Ejemplo n.º 3
0
def test_merge_func_code_skip_prefix():
    funccode, pos = merge_func_code(
        f, f2,
        prefix=['f_', 'g_'],
        skip_first=True,
        skip_prefix=['z'])
    assert funccode.co_varnames == ('x', 'f_y', 'z', 'g_a')
Ejemplo n.º 4
0
def test_merge_func_code():

    funccode, [pf, pg, ph] = merge_func_code(f, g, h)
    assert_equal(funccode.co_varnames, ('x', 'y', 'z', 'a', 'b', 'c', 'd'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)): assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)): assert_almost_equal(pg[i], exp_pg[i])
    exp_ph = [0, 5, 6]
    for i in range(len(ph)): assert_almost_equal(ph[i], exp_ph[i])
Ejemplo n.º 5
0
def test_merge_func_code_prefix():
    funccode, [pf, pg, ph] = merge_func_code(
        f, g, h,
        prefix=['f_', 'g_', 'h_'],
        skip_first=True)
    expected = 'x', 'f_y', 'f_z', 'g_a', 'g_b', 'h_c', 'h_d'
    assert funccode.co_varnames == expected
    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(ph) == (0, 5, 6)
Ejemplo n.º 6
0
def test_merge_func_code_prefix():
    funccode, [pf, pg, ph] = merge_func_code(f,
                                             g,
                                             h,
                                             prefix=["f_", "g_", "h_"],
                                             skip_first=True)
    expected = "x", "f_y", "f_z", "g_a", "g_b", "h_c", "h_d"
    assert funccode.co_varnames == expected
    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(ph) == (0, 5, 6)
Ejemplo n.º 7
0
def test_merge_func_code_prefix():
    funccode, [pf, pg, ph] = merge_func_code(
                                f, g, h,
                                prefix=['f_', 'g_', 'h_'],
                                skip_first=True)
    assert_equal(funccode.co_varnames, ('x', 'f_y', 'f_z',
                                        'g_a', 'g_b', 'h_c', 'h_d'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)): assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)): assert_almost_equal(pg[i], exp_pg[i])
    exp_ph = [0, 5, 6]
    for i in range(len(ph)): assert_almost_equal(ph[i], exp_ph[i])
Ejemplo n.º 8
0
def test_merge_func_code_factor_list():
    funccode, [pf, pg, pk_1, pk_2] = merge_func_code(
        f, g,
        prefix=['f_', 'g_'],
        skip_first=True,
        factor_list=[k_1, k_2])
    expected = 'x', 'f_y', 'f_z', 'g_a', 'g_b', 'g_i', 'g_j'
    assert funccode.co_varnames == expected

    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(pk_1) == (1, 2)
    assert tuple(pk_2) == (5, 6)
Ejemplo n.º 9
0
def test_merge_func_code_factor_list():
    funccode, [pf, pg, pk_1, pk_2] = merge_func_code(f,
                                                     g,
                                                     prefix=["f_", "g_"],
                                                     skip_first=True,
                                                     factor_list=[k_1, k_2])
    expected = "x", "f_y", "f_z", "g_a", "g_b", "g_i", "g_j"
    assert funccode.co_varnames == expected

    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(pk_1) == (1, 2)
    assert tuple(pk_2) == (5, 6)
Ejemplo n.º 10
0
def test_merge_func_code():

    funccode, [pf, pg, ph] = merge_func_code(f, g, h)
    assert_equal(funccode.co_varnames, ('x', 'y', 'z', 'a', 'b', 'c', 'd'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)):
        assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)):
        assert_almost_equal(pg[i], exp_pg[i])
    exp_ph = [0, 5, 6]
    for i in range(len(ph)):
        assert_almost_equal(ph[i], exp_ph[i])
Ejemplo n.º 11
0
def test_merge_func_code_factor_list():
    funccode, [pf, pg, pk_1, pk_2] = merge_func_code(
                                f, g,
                                prefix=['f_', 'g_'],
                                skip_first=True,
                                factor_list=[k_1, k_2])
    assert_equal(funccode.co_varnames, ('x', 'f_y', 'f_z',
                                        'g_a', 'g_b', 'g_i', 'g_j'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)): assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)): assert_almost_equal(pg[i], exp_pg[i])
    exp_pk_1 = [1, 2]
    for i in range(len(pk_1)): assert_almost_equal(pk_1[i], exp_pk_1[i])
    exp_pk_2 = [5, 6]
    for i in range(len(pk_1)): assert_almost_equal(pk_2[i], exp_pk_2[i])
Ejemplo n.º 12
0
def test_merge_func_code_prefix():
    funccode, [pf, pg, ph] = merge_func_code(f,
                                             g,
                                             h,
                                             prefix=['f_', 'g_', 'h_'],
                                             skip_first=True)
    assert_equal(funccode.co_varnames,
                 ('x', 'f_y', 'f_z', 'g_a', 'g_b', 'h_c', 'h_d'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)):
        assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)):
        assert_almost_equal(pg[i], exp_pg[i])
    exp_ph = [0, 5, 6]
    for i in range(len(ph)):
        assert_almost_equal(ph[i], exp_ph[i])
Ejemplo n.º 13
0
def test_merge_func_code_factor_list():
    funccode, [pf, pg, pk_1, pk_2] = merge_func_code(f,
                                                     g,
                                                     prefix=['f_', 'g_'],
                                                     skip_first=True,
                                                     factor_list=[k_1, k_2])
    assert_equal(funccode.co_varnames,
                 ('x', 'f_y', 'f_z', 'g_a', 'g_b', 'g_i', 'g_j'))
    exp_pf = [0, 1, 2]
    for i in range(len(pf)):
        assert_almost_equal(pf[i], exp_pf[i])
    exp_pg = [0, 3, 4]
    for i in range(len(pg)):
        assert_almost_equal(pg[i], exp_pg[i])
    exp_pk_1 = [1, 2]
    for i in range(len(pk_1)):
        assert_almost_equal(pk_1[i], exp_pk_1[i])
    exp_pk_2 = [5, 6]
    for i in range(len(pk_1)):
        assert_almost_equal(pk_2[i], exp_pk_2[i])
Ejemplo n.º 14
0
def test_merge_func_code():
    funccode, [pf, pg, ph] = merge_func_code(f, g, h)
    assert funccode.co_varnames == ('x', 'y', 'z', 'a', 'b', 'c', 'd')
    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(ph) == (0, 5, 6)
Ejemplo n.º 15
0
def test_merge_func_code():
    funccode, [pf, pg, ph] = merge_func_code(f, g, h)
    assert funccode.co_varnames == ("x", "y", "z", "a", "b", "c", "d")
    assert tuple(pf) == (0, 1, 2)
    assert tuple(pg) == (0, 3, 4)
    assert tuple(ph) == (0, 5, 6)