Skip to content

Commit c05165b

Browse files
author
Molly Xu
committed
Addressed comments regarding test_get_frames_at_fails
1 parent 030929d commit c05165b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/torchcodec/_core/ops.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,8 @@ def get_frames_by_pts(
222222
# Convert list to tensor for dispatch
223223
try:
224224
timestamps = torch.tensor(timestamps, dtype=torch.float64)
225-
except (ValueError, TypeError):
226-
# Type validation in C++ layer
227-
pass
225+
except Exception as e:
226+
raise ValueError("Couldn't convert timestamps input to a tensor") from e
228227
return _get_frames_by_pts_tensor_input(decoder, timestamps=timestamps)
229228

230229

test/test_decoders.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,9 @@ def test_get_frames_played_at_fails(self, device, seek_mode):
699699
with pytest.raises(RuntimeError, match="must be less than"):
700700
decoder.get_frames_played_at([14])
701701

702-
with pytest.raises(RuntimeError, match="Expected a value of type"):
702+
with pytest.raises(
703+
ValueError, match="Couldn't convert timestamps input to a tensor"
704+
):
703705
decoder.get_frames_played_at(["bad"])
704706

705707
@pytest.mark.parametrize("device", all_supported_devices())

0 commit comments

Comments
 (0)