code: def test_images(
      art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack
  ):
      try:
          (
              x_train_mnist,
              y_train_mnist,
              x_test_mnist,
              y_test_mnist,
          ) = fix_get_mnist_subset
          classifier = image_dl_estimator_for_attack(
              MomentumIterativeMethod
          )
  
          attack = MomentumIterativeMethod(
              classifier, eps=0.3, eps_step=0.1, decay=1.0, max_iter=10
          )
          x_train_mnist_adv = attack.generate(x=x_train_mnist)
  
          assert np.mean(x_train_mnist) == pytest.approx(
              0.12659499049186707, 0.01
          )
          assert np.mean(
              np.abs(x_train_mnist - x_train_mnist_adv)
          ) == pytest.approx(0.09437845647335052, abs=0.05)
          assert np.max(
              np.abs(x_train_mnist - x_train_mnist_adv)
          ) == pytest.approx(0.3)
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/evasion/test_momentum_iterative_method.py
imports: import logging
  import numpy
  import pytest
  from art.attacks.evasion import MomentumIterativeMethod
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from tests.attacks.utils import backend_test_classifier_type_check_fail
  from tests.utils import ARTTestException
label_desc: Use image node_id 2 for calling a global function with example usage: test_images(art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack) without return types