code: def test_return_nan_when_prediction_changes_continuity(
      load_mnist_model, load_mnist_images, mock_prediction_changed
  ):
      # Continuity returns dict, so we have it in separate function in order to keep assertions readable.
      metric_instance = Continuity(
          disable_warnings=True,
          return_nan_when_prediction_changes=True,
          nr_steps=10,
          patch_size=7,
      )
      result = metric_instance(
          load_mnist_model,
          load_mnist_images["x_batch"],
          load_mnist_images["y_batch"],
          explain_func=explain,
          explain_func_kwargs={
              "method": "Saliency",
          },
      )
      for i in result:
          values = list(i.values())
          # Last element of scores is output logits, obviously they're not nan.
          for v in values[:-1]:
              assert np.isnan(v).any()
  
file_path: Quantus/tests/metrics/test_robustness_metrics.py
imports: from typing import Union, Dict
  from pytest_lazyfixture import lazy_fixture
  import pytest
  import numpy
  from quantus.functions.explanation_func import explain
  from quantus.functions.discretise_func import floating_points, rank, sign, top_n_sign
  from quantus.helpers.model.model_interface import ModelInterface
  from quantus.metrics.robustness import AvgSensitivity, Consistency, Continuity, LocalLipschitzEstimate, MaxSensitivity
label_desc: Use image node_id 7 for calling a global function with example usage: test_return_nan_when_prediction_changes_continuity(load_mnist_model, load_mnist_images, mock_prediction_changed) without return types