def METHOD_NAME(self):
    """Test that the correct cost is returned via the step_and_cost method for the
    Nesterov momentum optimizer"""
    stepsize, gamma = 0.1, 0.5
    nesmom_opt = NesterovMomentumOptimizer(stepsize, momentum=gamma)
    @qml.qnode(qml.device("default.qubit", wires=1))
    def quant_fun(*variables):
        qml.RX(variables[0][1], wires=[0])
        qml.RY(variables[1][2], wires=[0])
        qml.RY(variables[2], wires=[0])
        return qml.expval(qml.PauliZ(0))
    inputs = [
        np.array((0.2, 0.3), requires_grad=True),
        np.array([0.4, 0.2, 0.4], requires_grad=True),
        np.array(0.1, requires_grad=True),
    ]
    _, res = nesmom_opt.step_and_cost(quant_fun, *inputs)
    expected = quant_fun(*inputs)
    assert np.all(res == expected)