Beispiel #1
0
 def test_lendiff_match_from_start(self):
     stats = compute_stats(io.StringIO(input_lendiff),
                           match_from_start=True)
     self.assertEqual(stats['tp'], 0)
     self.assertEqual(stats['tn'], 2)
     self.assertEqual(stats['fp'], 2)
     self.assertEqual(stats['fn'], 2)
Beispiel #2
0
 def test_lendiff_shorter(self):
     stats = compute_stats(io.StringIO(input_shorter_output))
     self.assertEqual(stats['tp'], 0)
     self.assertEqual(stats['tn'], 2)
     self.assertEqual(stats['fp'], 0)
     self.assertEqual(stats['fn'], 1)
Beispiel #3
0
 def test_short_almost_correct(self):
     stats = compute_stats(io.StringIO(short_almost_correct))
     self.assertEqual(stats['precision'], 0.5)
     self.assertEqual(stats['recall'], 1.0)
     self.assertEqual(stats['accuracy'], 2.0 / 3)
     self.assertEqual(stats['F-score'], 2.0 / 3)
Beispiel #4
0
 def test_correct(self):
     stats = compute_stats(io.StringIO(correct_input))
     self.assertEqual(stats['precision'], 1.0)
     self.assertEqual(stats['recall'], 1.0)
     self.assertEqual(stats['accuracy'], 1.0)
     self.assertEqual(stats['F-score'], 1.0)