Skip to content

Commit

Permalink
Added code to raise exception with string - now reformatted for appro…
Browse files Browse the repository at this point in the history
…val (#1952)

Reformat files for code format check
  • Loading branch information
stef405 authored May 26, 2023
1 parent 57c279a commit b5bb086
Show file tree
Hide file tree
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
Expand Up @@ -1190,6 +1190,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__(
Expand Down
5 changes: 4 additions & 1 deletion tests/test_VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b5bb086

Please sign in to comment.