Project Name: Zulko+moviepy
Language: Python
Statement Type: API

Source Code:
def test_mask_and(image_from, duration, color, mask_color, expected_color):
    """Checks ``mask_and`` FX behaviour."""
    clip_size = tuple(random.randint(3, 10) for i in range(2))

    if duration == "random":
        duration = round(random.uniform(0, 0.5), 2)

    # test ImageClip and np.ndarray types as mask argument
    clip = ColorClip(color=color, size=clip_size).with_duration(duration)
    mask_clip = ColorClip(color=mask_color, size=clip.size)
    masked_clip = mask_and(
        clip, mask_clip if image_from == "ImageClip" else mask_clip.get_frame(0)
    )

    assert masked_clip.duration == clip.duration
    assert np.array_equal(masked_clip.get_frame(0)[0][0], np.array(expected_color))

    # test VideoClip as mask argument
    color_frame, mask_color_frame = (np.array([[color]]), np.array([[mask_color]]))
    clip = VideoClip(lambda t: color_frame).with_duration(duration)
    mask_clip = VideoClip(lambda t: mask_color_frame).with_duration(duration)
    masked_clip = mask_and(clip, mask_clip)

    assert np.array_equal(masked_clip.get_frame(0)[0][0], np.array(expected_color))

test_mask_and(image_from='np.ndarray', duration=None, color=(0, 0, 0), mask_color=(255, 255, 255), expected_color=(0, 0, 0))

Selected Statement: mask_clip = VideoClip(lambda t: mask_color_frame).with_duration(duration)

Function Input:
image_from: 'np.ndarray'
duration: None
color: (0, 0, 0)
mask_color: (255, 255, 255)
expected_color: (0, 0, 0)

Variable Values Before Statement:
duration: None

Value After Statement Execution: {start

Variable States During Runtime (line, value):
image_from: 1
'np.ndarray'
duration: 1
None
color: 1
(0, 0, 0)
mask_color: 1
(255, 255, 255)
expected_color: 1
(0, 0, 0)
clip_size: 3
(8, 3)
clip: 9
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, is_mask=False, has_constant_size=True, size=(8, 3), img=array([[[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]],       [[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]],       [[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]]])}
20
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True}
mask_clip: 10
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, is_mask=False, has_constant_size=True, size=(8, 3), img=array([[[255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255]],       [[255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255]],       [[255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255],        [255, 255, 255]]])}
21
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True}
masked_clip: 11
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, is_mask=False, has_constant_size=True, size=(8, 3), img=array([[[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]],       [[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]],       [[0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0],        [0, 0, 0]]])}
22
{start=0, end=None, duration=None, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True}
@py_assert1: 15
None
@py_assert5: 15
None
@py_assert3: 15
None
@py_assert6: 16
None
@py_assert9: 16
None
@py_assert11: 16
None
color_frame: 19
array([[[0, 0, 0]]])
mask_color_frame: 19
array([[[255, 255, 255]]])