Ejemplo n.º 1
0
 def test_compare_by_index_wrong_type(self):
     """
     Tests that when a valid Annotations object calls the compare_by_entity() method with an object that is not an
     Annotations, it raises ValueError.
     """
     annotations1 = Annotations(self.ann_file_path_one, annotation_type='ann')
     annotations2 = "This is not an Annotations object"
     with self.assertRaises(ValueError):
         annotations1.compare_by_index(annotations2)
Ejemplo n.º 2
0
 def test_compare_by_index_all_entities_matched(self):
     """
     Tests that when compare_by_index() is called with nearly-identical data, the calculations accurately pair
     annotations that refer to the same instance of an entity but are not identical. Specifically, test that list
     "NOT_MATCHED" is empty.
     """
     annotations1 = Annotations(self.ann_file_path_one_modified)
     annotations2 = Annotations(self.ann_file_path_one)
     comparison = annotations1.compare_by_index(annotations2, strict=1)
     self.assertListEqual(comparison["NOT_MATCHED"], [])
Ejemplo n.º 3
0
 def test_compare_by_index_strict_lt_0(self):
     """Tests that when compare_by_index() is called with a strict below 0, it raises ValueError."""
     annotations1 = Annotations(self.ann_file_path_one, annotation_type='ann')
     annotations2 = Annotations(self.ann_file_path_two, annotation_type='ann')
     with self.assertRaises(ValueError):
         annotations1.compare_by_index(annotations2, strict=-1)
Ejemplo n.º 4
0
 def test_compare_by_index_valid_data_return_dict(self):
     """Tests that when compare_by_index() is called with valid data, it returns a dict."""
     annotations1 = Annotations(self.ann_file_path_one, annotation_type='ann')
     annotations2 = Annotations(self.ann_file_path_two, annotation_type='ann')
     result = annotations1.compare_by_index(annotations2)
     self.assertIsInstance(result, dict)