code: def test_detection_labelling(self):
      dataset = (
          foz.load_zoo_dataset("quickstart")
          .select_fields("ground_truth")
          .clone()
      )
      # Get a subset that contains at least 2 objects
      dataset = dataset.match(
          F("ground_truth.detections").length() > 1
      )[:2].clone()
  
      previous_dataset = dataset.clone()
  
      previous_label_ids = dataset.values(
          "ground_truth.detections.id", unwind=True
      )
  
      anno_key = "anno_key"
      attributes = {"test": {"type": "text", "values": []}}
  
      results = dataset.annotate(
          anno_key,
          backend="cvat",
          label_field="ground_truth",
          attributes=attributes,
      )
  
      with results:
          api = results.connect_to_api()
          task_id = results.task_ids[0]
          deleted_label_id = previous_label_ids[0]
          updated_label_id = previous_label_ids[1]
  
          _delete_shape(api, task_id, deleted_label_id)
          _create_annotation(api, task_id, shape=True)
          _update_shape(
              api, task_id, updated_label_id, attributes=[("test", "1")]
          )
  
          dataset.load_annotations(anno_key, cleanup=True)
          label_ids = dataset.values(
              "ground_truth.detections.id", unwind=True
          )
  
          self.assertEqual(len(label_ids), len(previous_label_ids))
  
          added_label_ids = list(
              set(label_ids) - set(previous_label_ids)
          )
          self.assertEqual(len(added_label_ids), 1)
          deleted_label_ids = list(
              set(previous_label_ids) - set(label_ids)
          )
          self.assertEqual(len(deleted_label_ids), 1)
  
          updated_sample = dataset.filter_labels(
              "ground_truth", F("_id") == ObjectId(updated_label_id)
          ).first()
          prev_updated_sample = previous_dataset.filter_labels(
              "ground_truth", F("_id") == ObjectId(updated_label_id)
          ).first()
  
          self.assertEqual(
              len(updated_sample.ground_truth.detections), 1
          )
          self.assertEqual(
              len(prev_updated_sample.ground_truth.detections), 1
          )
          self.assertEqual(
              updated_sample.ground_truth.detections[0].id,
              prev_updated_sample.ground_truth.detections[0].id,
          )
          self.assertEqual(
              updated_sample.ground_truth.detections[0].test, 1
          )
  
imports: from bson import ObjectId
  from collections import defaultdict
  import numpy
  import os
  import unittest
  import eta.core.utils
  import fiftyone
  import fiftyone.utils.cvat
  import fiftyone.zoo
  from fiftyone.core.expressions import ViewField
label_desc: Use image node_id 2 for calling the CVATTests obj's underlying member method code with example usage: obj.test_detection_labelling() without return types