class_docstr: Test class collection different tests for different properties parametrized by backend argument.
class_docstr_tok: ["Test","class","collection","different","tests","for","different","properties","parametrized","by","backend","argument","."]
docstr: Test how metric is working when list of max detection thresholds is not 3.
  
  This is a known limitation of the pycocotools where values are hardcoded to expect at least 3 elements
  https://github.com/ppwwyyxx/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L461
docstr_tok: ["Test","how","metric","is","working","when","list","of","max","detection","thresholds","is","not","3",".","This","is","a","known","limitation","of","the","pycocotools","where","values","are","hardcoded","to","expect","at","least","3","elements","https",":","\/\/github.com\/ppwwyyxx\/cocoapi\/blob\/master\/PythonAPI\/pycocotools\/cocoeval.py","#","L461"]
code: def test_with_more_and_less_detection_thresholds(
      self, max_detection_thresholds, backend
  ):
      """Test how metric is working when list of max detection thresholds is not 3.
  
      This is a known limitation of the pycocotools where values are hardcoded to expect at least 3 elements
      https://github.com/ppwwyyxx/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L461
  
      """
      preds = [
          {
              "boxes": torch.tensor([[258.0, 41.0, 606.0, 285.0]]),
              "scores": torch.tensor([0.536]),
              "labels": torch.tensor([0]),
          }
      ]
      target = [
          {
              "boxes": torch.tensor([[214.0, 41.0, 562.0, 285.0]]),
              "labels": torch.tensor([0]),
          }
      ]
  
      if backend == "pycocotools":
          with pytest.raises(
              ValueError,
              match="When using `pycocotools` backend the number of max detection thresholds should.*",
          ):
              metric = MeanAveragePrecision(
                  max_detection_thresholds=max_detection_thresholds,
                  backend=backend,
              )
      else:
          metric = MeanAveragePrecision(
              max_detection_thresholds=max_detection_thresholds,
              backend=backend,
          )
          metric(preds, target)
  
imports: import contextlib
  import io
  import json
  from copy import deepcopy
  from functools import partial
  from itertools import product
  import numpy
  import pytest
  import torch
  from lightning_utilities import apply_to_collection
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from torch import IntTensor, Tensor
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  from torchmetrics.utilities.imports import _FASTER_COCO_EVAL_AVAILABLE, _PYCOCOTOOLS_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_8
  from unittests.detection import _DETECTION_BBOX, _DETECTION_SEGM, _DETECTION_VAL
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 22 for calling the TestMapProperties obj's underlying member method code with example usage: obj.test_with_more_and_less_detection_thresholds(max_detection_thresholds, backend) without return types