Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added code to raise exception with string - now reformatted for approval
Browse files Browse the repository at this point in the history
Reformat files for code format check
stef405 committed Apr 20, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 86fd511 commit 3aa1a4d
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
@@ -1149,6 +1149,10 @@ def __init__(self, size, color=None, is_mask=False, duration=None):
color = (0, 0, 0)
elif not hasattr(color, "__getitem__"):
raise Exception("Color has to contain RGB of the clip")
elif isinstance(color, str):
raise Exception(
"Color cannot be string. Color has to contain RGB of the clip"
)
shape = (h, w, len(color))

super().__init__(
5 changes: 4 additions & 1 deletion tests/test_VideoClip.py
Original file line number Diff line number Diff line change
@@ -264,7 +264,10 @@ def test_oncolor(util):
clip = ColorClip(size=(100, 60), color=(255, 0, 0), is_mask=True)

with pytest.raises(Exception):
clip = ColorClip(size=(100, 60), color=0.4, is_mask=False)
clip = ColorClip(size=(100, 60), color=0.4, ismask=False)

with pytest.raises(Exception):
clip = ColorClip(size=(100, 60), color="black")


def test_setaudio(util):

0 comments on commit 3aa1a4d

Please sign in to comment.