Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-b-miller committed May 12, 2021
1 parent c066308 commit a8e65ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
5 changes: 4 additions & 1 deletion python/cudf/cudf/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def __setitem__(self, key, value):
else:
value = column.as_column(value)
if (
not isinstance(self._sr._column.dtype, (cudf.Decimal64Dtype, cudf.CategoricalDtype))
not isinstance(
self._sr._column.dtype,
(cudf.Decimal64Dtype, cudf.CategoricalDtype),
)
and hasattr(value, "dtype")
and pd.api.types.is_numeric_dtype(value.dtype)
):
Expand Down
16 changes: 2 additions & 14 deletions python/cudf/cudf/tests/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,9 @@ def test_typecast_from_decimal(data, from_dtype, to_dtype):
pa.lib.ArrowInvalid,
),
# We will allow for setting scalars into decimal columns
(
["1", "2", "3"],
Decimal64Dtype(1, 0),
5,
1,
["1", "5", "3"]
),
(["1", "2", "3"], Decimal64Dtype(1, 0), 5, 1, ["1", "5", "3"]),
# But not if it has too many digits to fit the precision
(
["1", "2", "3"],
Decimal64Dtype(1, 0),
50,
1,
pa.lib.ArrowInvalid
),
(["1", "2", "3"], Decimal64Dtype(1, 0), 50, 1, pa.lib.ArrowInvalid),
],
)
def test_series_setitem_decimal(args):
Expand Down

0 comments on commit a8e65ca

Please sign in to comment.