diff --git a/python/cudf/cudf/core/dtypes.py b/python/cudf/cudf/core/dtypes.py index 6a25323e0e8..9991bad5a9e 100644 --- a/python/cudf/cudf/core/dtypes.py +++ b/python/cudf/cudf/core/dtypes.py @@ -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