Skip to content

Commit

Permalink
assert rather than raising AssertionError
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- committed May 6, 2022
1 parent 9e855a5 commit 63fede6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions python/cudf/cudf/core/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,14 @@ class performing deserialization
if the number of frames doesn't match the count encoded in the
headers, or `is_valid_class` is not true.
"""
if header["frame_count"] != len(frames):
raise AssertionError(
f"Deserialization expected {header['frame_count']} frames, "
f"but received {len(frames)}."
)
assert header["frame_count"] == len(frames), (
f"Deserialization expected {header['frame_count']} frames, "
f"but received {len(frames)}."
)
klass = pickle.loads(header["type-serialized"])
if not is_valid_class(klass, cls):
raise AssertionError(
f"Header-encoded {klass=} does not match decoding {cls=}."
)
assert is_valid_class(
klass, cls
), f"Header-encoded {klass=} does not match decoding {cls=}."
return header, frames, klass


Expand Down

0 comments on commit 63fede6

Please sign in to comment.