Skip to content

Commit

Permalink
Change error in combine_images_to_video and add test
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <[email protected]>
  • Loading branch information
bmmtstb committed Apr 6, 2024
1 parent 034395c commit ffad5df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dgs/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def combine_images_to_video(
elif isinstance(imgs, list):
images = transform_dtype(torch.cat(imgs))
else:
raise NotImplementedError(f"Unknown input format.")
raise TypeError(f"Unknown input format. Got {type(imgs)}")

# change order of the dimensions
video_tensor = torch.permute(images, (0, 2, 3, 1))
Expand Down
5 changes: 5 additions & 0 deletions tests/utils/test__image.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def test_combine_images_to_video(self):

shutil.rmtree("./tests/test_data/video_out/")

def test_combine_exceptions(self):
with self.assertRaises(TypeError) as e:
combine_images_to_video(imgs=np.ones(1), video_file="./tests/test_data/video_out/test1.mp4")
self.assertTrue("Unknown input format. Got" in str(e.exception), msg=e.exception)


class TestImage(unittest.TestCase):

Expand Down

0 comments on commit ffad5df

Please sign in to comment.