code: def test_mnist_alt(mnist_visiondata_train, mnist_visiondata_test):
      # Arrange
      scorers = {
          "p": CustomClassificationScorer("precision_per_class"),
          "r": CustomClassificationScorer("recall_per_class"),
      }
      check = ClassPerformance(
          n_to_show=2, show_only="smallest", scorers=scorers
      ).add_condition_test_performance_greater_than(1)
      # Act
      result = check.run(mnist_visiondata_train, mnist_visiondata_test)
  
      # Assert
      assert_that(result.display, has_length(1))
      figure = t.cast(BaseFigure, result.display[0])
      assert_that(figure, instance_of(BaseFigure))
      assert_that(figure.data[0]["y"][0], close_to(1.0, 0.01))
      assert_that(figure.data[0]["y"][1], close_to(0.937, 0.01))
      assert_that(
          figure.data[0]["hovertemplate"],
          equal_to(
              "Dataset=Train<br>Metric=p<br>Class Name=%{x}<br>"
              "sum of Value=%{y}<extra></extra>"
          ),
      )
      assert_that(figure.data[1]["y"][0], close_to(1.0, 0.01))
      assert_that(figure.data[1]["y"][1], close_to(1, 0.01))
      assert_that(
          figure.data[1]["hovertemplate"],
          equal_to(
              "Dataset=Train<br>Metric=r<br>Class Name=%{x}<br>"
              "sum of Value=%{y}<extra></extra>"
          ),
      )
  
      value = result.value
      assert_that(set(value["Class"]), has_length(10))
      assert_that(value, has_length(40))
      assert_that(
          min(value[value["Dataset"] == "Test"]["Value"]),
          close_to(0.9375, 0.01),
      )
      assert_that(
          min(value[value["Dataset"] == "Train"]["Value"]),
          close_to(0.869, 0.01),
      )
      assert_that(
          max(value[value["Dataset"] == "Test"]["Value"]), equal_to(1.0)
      )
      assert_that(
          max(value[value["Dataset"] == "Train"]["Value"]),
          equal_to(1.0),
      )
  
      assert_that(
          result.conditions_results,
          has_items(
              equal_condition_result(
                  is_pass=False,
                  details=re.compile(
                      r"Found 20 scores below threshold.\nFound minimum score for r metric of value 0.93 for class \d."
                  ),
                  name="Scores are greater than 1",
              )
          ),
      )
  
imports: import re
  import typing
  from hamcrest import assert_that, calling, close_to, equal_to, greater_than, has_items, has_length, instance_of, raises
  from plotly.basedatatypes import BaseFigure
  from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError
  from deepchecks.vision.checks import ClassPerformance
  from deepchecks.vision.metrics_utils import CustomClassificationScorer
  from deepchecks.vision.metrics_utils.confusion_matrix_counts_metrics import AVAILABLE_EVALUATING_FUNCTIONS
  from tests.base.utils import equal_condition_result
label_desc: Use image node_id 5 for calling a global function with example usage: test_mnist_alt(mnist_visiondata_train, mnist_visiondata_test) without return types