Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-b-miller committed Apr 15, 2021
1 parent e02252b commit 1d24130
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions python/cudf/cudf/tests/test_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,25 +234,25 @@ def test_generic_null_scalar_construction_fails(value):


@pytest.mark.parametrize(
"dtype",
NUMERIC_TYPES
+ DATETIME_TYPES
+ TIMEDELTA_TYPES
+ ["object"]
"dtype", NUMERIC_TYPES + DATETIME_TYPES + TIMEDELTA_TYPES + ["object"]
)
def test_scalar_dtype_and_validity(dtype):
s = cudf.Scalar(1, dtype=dtype)

assert s.dtype == np.dtype(dtype)
assert s.is_valid() is True

@pytest.mark.parametrize('slr,dtype,expect', [
(1, cudf.Decimal64Dtype(1, 0), Decimal('1')),
(Decimal(1), cudf.Decimal64Dtype(1, 0), Decimal('1')),
(Decimal('1.1'), cudf.Decimal64Dtype(2,1), Decimal('1.1')),
(Decimal('1.1'), cudf.Decimal64Dtype(4,3), Decimal('1.100')),
(Decimal('1.11'), cudf.Decimal64Dtype(2,2), pa.lib.ArrowInvalid)
])

@pytest.mark.parametrize(
"slr,dtype,expect",
[
(1, cudf.Decimal64Dtype(1, 0), Decimal("1")),
(Decimal(1), cudf.Decimal64Dtype(1, 0), Decimal("1")),
(Decimal("1.1"), cudf.Decimal64Dtype(2, 1), Decimal("1.1")),
(Decimal("1.1"), cudf.Decimal64Dtype(4, 3), Decimal("1.100")),
(Decimal("1.11"), cudf.Decimal64Dtype(2, 2), pa.lib.ArrowInvalid),
],
)
def test_scalar_dtype_and_validity_decimal(slr, dtype, expect):
if expect is pa.lib.ArrowInvalid:
with pytest.raises(expect):
Expand All @@ -263,6 +263,7 @@ def test_scalar_dtype_and_validity_decimal(slr, dtype, expect):
assert result.dtype == dtype
assert result.is_valid


@pytest.mark.parametrize(
"value",
[
Expand Down

0 comments on commit 1d24130

Please sign in to comment.