def METHOD_NAME():
    def func(x, x_adv):
        return (x + x_adv).sum()
    with pytest.raises(ValueError):
        perturbation._generate_video_metric(func, frame_average="not right")
    docstring = "My Custom Docstring"
    image_dim = (28, 28, 1)
    pixels = np.product(image_dim)
    for name in "mean", "max", "min":
        new_metric = perturbation._generate_video_metric(
            func, frame_average=name, docstring=docstring
        )
        assert new_metric.__doc__ == docstring
    x = np.zeros((3,) + image_dim)
    x_adv = np.stack(
        [0 * np.ones(image_dim), 1 * np.ones(image_dim), 2 * np.ones(image_dim)]
    )
    assert perturbation.element.max_l1(x, x_adv) == 2 * pixels
    assert perturbation.element.mean_l1(x, x_adv) == pixels
    min_l1 = perturbation._generate_video_metric(
        perturbation.element.l1, frame_average="min"
    )
    assert min_l1(x, x_adv) == 0