コード例 #1
0
ファイル: test_annotation.py プロジェクト: ggurdin/medaCy
 def test_different_file_diff(self):
     """Tests that when two different files are used in the diff() method, either ValueError is raised (because the
     two Annotations cannot be compared) or that the output is a list with more than one value."""
     annotations1 = Annotations(join(self.dataset.get_data_directory(), self.ann_files[0]), annotation_type='ann')
     annotations2 = Annotations(join(self.dataset.get_data_directory(), self.ann_files[1]), annotation_type='ann')
     if annotations1.annotations['entities'].values().__len__() != \
             annotations2.annotations['entities'].values().__len__():
         with self.assertRaises(ValueError):
             annotations1.diff(annotations2)
     else:
         result = annotations1.diff(annotations2)
         self.assertTrue(result.__len__() > 0)
コード例 #2
0
ファイル: test_annotation.py プロジェクト: ggurdin/medaCy
 def test_same_file_diff(self):
     """Tests that when a given Annotations object uses the diff() method with another Annotations object created
     from the same source file, that it returns an empty list."""
     annotations1 = Annotations(join(self.dataset.get_data_directory(), self.ann_files[0]), annotation_type='ann')
     annotations2 = Annotations(join(self.dataset.get_data_directory(), self.ann_files[0]), annotation_type='ann')
     result = annotations1.diff(annotations2)
     self.assertEquals(result, [])
コード例 #3
0
 def test_same_file_diff(self):
     """
     Tests that when a given Annotations object uses the diff() method with another Annotations object created
     from the same source file, that it returns an empty list.
     """
     annotations1 = Annotations(self.ann_file_path_one, annotation_type='ann')
     annotations2 = Annotations(self.ann_file_path_one, annotation_type='ann')
     result = annotations1.diff(annotations2)
     self.assertEqual(result, [])
コード例 #4
0
 def test_different_file_diff(self):
     """
     Tests that when two different files with the same number of annotations are used in the diff() method,
     the output is a list with more than one value.
     """
     # Note that both of these files contain ten annotations
     annotations1 = Annotations(self.ann_file_path_one, annotation_type='ann')
     annotations2 = Annotations(self.ann_file_path_two, annotation_type='ann')
     result = annotations1.diff(annotations2)
     self.assertGreater(len(result), 0)