Esempio n. 1
0
def test_cast_int_to_bool(source_stype):
    DT = dt.Frame(N=[-11, -1, None, 0, 1, 11, 127], stype=source_stype)
    assert DT.stypes == (source_stype, )
    RES = DT[:, dt.bool8(f.N)]
    frame_integrity_check(RES)
    assert RES.stypes == (dt.bool8, )
    assert RES.to_list()[0] == [True, True, None, False, True, True, True]
Esempio n. 2
0
def test_cast_float_to_bool(source_stype):
    DT = dt.Frame(G=[-math.inf, math.inf, math.nan, 0.0, 13.4, 1.0, -1.0, -128],
                  stype=source_stype)
    assert DT.stypes == (source_stype,)
    RES = DT[:, dt.bool8(f.G)]
    frame_integrity_check(RES)
    assert RES.stypes == (dt.bool8,)
    assert RES.to_list()[0] == [True, True, None, False, True, True, True, True]
Esempio n. 3
0
def test_cast_m127_to_bool():
    DT = dt.Frame([-128, -127, 0, 127, 128, 256])
    RES = DT[:, dt.bool8(f[0])]
    frame_integrity_check(RES)
    assert RES.stypes == (dt.bool8, )
    assert RES.to_list()[0] == [True, True, False, True, True, True]
Esempio n. 4
0
def test_cast_bool_to_bool():
    DT = dt.Frame(B=[None, True, False, None, True, True, False, False])
    assert DT.stypes == (dt.bool8, )
    RES = DT[:, {"B": dt.bool8(f.B)}]
    assert_equals(DT, RES)