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")
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'))
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')
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])
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)
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)
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])
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)
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)
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])
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])
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])
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)
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)