Exemplo n.º 1
0
def test_list_scalar_device_construction_null(nesting_level):
    data = [[]]
    for i in range(nesting_level - 1):
        data = [data]

    arrow_type = pa.infer_type(data)
    arrow_arr = pa.array([None], type=arrow_type)

    col = cudf.Series(arrow_arr)._column
    slr = get_element(col, 0)

    assert slr.value is cudf.NA
Exemplo n.º 2
0
def test_scalar_device_initialization(value):
    column = cudf.Series([value], nan_as_null=False)._column
    dev_slr = get_element(column, 0)

    s = cudf.Scalar(dev_slr)

    assert s._is_device_value_current
    assert not s._is_host_value_current

    assert s.value == value or np.isnan(s.value) and np.isnan(value)

    assert s._is_device_value_current
    assert s._is_host_value_current
Exemplo n.º 3
0
def test_scalar_device_initialization_decimal(value):
    dtype = cudf.Decimal64Dtype._from_decimal(value)
    column = cudf.Series([str(value)]).astype(dtype)._column
    dev_slr = get_element(column, 0)

    s = cudf.Scalar(dev_slr)

    assert s._is_device_value_current
    assert not s._is_host_value_current

    assert s.value == value

    assert s._is_device_value_current
    assert s._is_host_value_current
Exemplo n.º 4
0
def test_list_scalar_device_construction(data):
    col = cudf.Series([data])._column
    slr = get_element(col, 0)
    assert slr.value == data