def test_convert_to_csv_with_label_confidence(self):
        test_detection = {
            'coordinates': [200, 100, 300, 200],
            'confidence': 0.998,
            'class_id': 16,
            'label': 'contramano'
        }

        csv_output = convert_detection_to_csv(test_detection, include_label=True, include_confidence=True)
        expected_output = '16, contramano, 0.998, 200, 100, 300, 200'

        assert csv_output == expected_output
    def test_convert_to_csv(self):
        test_detection = {
            'coordinates': [200, 100, 300, 200],
            'confidence': 0.998,
            'class_id': 16,
            'label': 'contramano'
        }

        csv_output = convert_detection_to_csv(test_detection)
        expected_output = '16, 200, 100, 300, 200'

        assert csv_output == expected_output
 def save_detections_to_csv(self, detections, output):
     with open(output, 'w') as fp:
         for detection in detections:
             csv_detection = convert_detection_to_csv(detection)
             fp.write(csv_detection + '\n')