コード例 #1
0
def test_resolve_hidden_name():
    define_alias("jets", "pt", lambda j: j.pt / 1000.0)

    df = DataFrame()
    df = df.jets
    r = lookup_alias(df, "pt")
    assert r is not None
    df1 = r.apply(df)
    assert df1.child_expr is not None
    t = ast.dump(df1.child_expr)
    assert '1000' in t
コード例 #2
0
def test_resolve_two_names_good_2():
    define_alias("jets", "pts", lambda j: j.pt / 1000.0)
    define_alias("eles", "pts", lambda j: j.pt / 2000.0)
    df = DataFrame()
    df = df.eles
    r = lookup_alias(df, "pts")
    assert r is not None
    df1 = r.apply(df)
    assert df1.child_expr is not None
    t = ast.dump(df1.child_expr)
    assert '2000' in t
コード例 #3
0
def test_resolve_partial_wildcard_nogood_1():
    define_alias("jets", "pts", lambda j: j.pt / 1000.0)
    df = DataFrame()
    df = df.eles
    r = lookup_alias(df, "pts")
    assert r is None
コード例 #4
0
def test_resolve_wilecard_nogood():
    define_alias("", "pts", lambda j: j.pt / 1000.0)
    df = DataFrame()
    r = lookup_alias(df, "pt")
    assert r is None
コード例 #5
0
def test_resolve_wilecard_good_1():
    define_alias("", "pts", lambda j: j.pt / 1000.0)
    df = DataFrame()
    df = df.jets
    r = lookup_alias(df, "pts")
    assert r is not None
コード例 #6
0
def test_resolve_well_specified_nogood_3():
    define_alias(".jets", "pts", lambda j: j.pt / 1000.0)
    df = DataFrame()
    df = df.eles
    r = lookup_alias(df, "pts")
    assert r is None
コード例 #7
0
def test_resolve_root_good():
    define_alias(".", "pts", lambda j: j.pt / 1000.0)
    df = DataFrame()
    df = df
    r = lookup_alias(df, "pts")
    assert r is not None