code: def test_apply_patch(art_warning, fix_get_rcnn):
      try:
          frcnn = fix_get_rcnn
          attack = RobustDPatch(
              frcnn,
              patch_shape=(4, 4, 1),
              patch_location=(2, 2),
              crop_range=(0, 0),
              brightness_range=(1.0, 1.0),
              rotation_weights=(1, 0, 0, 0),
              sample_size=1,
              learning_rate=1.0,
              max_iter=1,
              batch_size=1,
              verbose=False,
          )
  
          patch = np.ones(shape=(4, 4, 1))
          x = np.zeros(shape=(1, 10, 10, 1))
  
          patched_images = attack.apply_patch(x=x, patch_external=patch)
  
          patch_sum_expected = 16.0
          complement_sum_expected = 0.0
  
          patch_sum = np.sum(patched_images[0, 2:7, 2:7, :])
          complement_sum = np.sum(patched_images[0]) - patch_sum
  
          assert patch_sum == patch_sum_expected
          assert complement_sum == complement_sum_expected
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/evasion/test_dpatch_robust.py
imports: import logging
  import numpy
  import pytest
  from art.attacks.evasion import RobustDPatch
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.object_detection.object_detector import ObjectDetectorMixin
  from tests.attacks.utils import backend_test_classifier_type_check_fail
  from tests.utils import ARTTestException
label_desc: Use image node_id 5 for calling a global function with example usage: test_apply_patch(art_warning, fix_get_rcnn) without return types