Exemplo n.º 1
0
 def test_compare8(self):
     l1 = "Mary Sue"
     l2 = ""
     r = _diff(l1, l2)
     self.assertEqual(r['deletions'], 2)
     self.assertEqual(r['additions'], 0)
     self.assertEqual(r['jaccard'], 0.0)
Exemplo n.º 2
0
 def test_compare(self):
     l1 = "Hello Mary Sue from Johnny"
     l2 = "Hello John Doe from Jakob"
     r = _diff(l1, l2)
     self.assertEqual(r['deletions'], 3)
     self.assertEqual(r['additions'], 3)
     self.assertEqual(r['jaccard'], 0.25)
Exemplo n.º 3
0
 def test_compare4(self):
     l1 = "Hello John Doe"
     l2 = "Hello John Doe"
     r = _diff(l1, l2)
     self.assertEqual(r['deletions'], 0)
     self.assertEqual(r['additions'], 0)
     self.assertEqual(r['jaccard'], 1.0)
Exemplo n.º 4
0
 def test_compare6(self):
     l1 = "John Doe"
     l2 = "John Doe Silver"
     r = _diff(l1, l2)
     self.assertEqual(r['deletions'], 0)
     self.assertEqual(r['additions'], 1)
     self.assertEqual(r['jaccard'], 0.667)
Exemplo n.º 5
0
 def test_compare2(self):
     l1 = "Hello Mary Sue"
     l2 = "Hello John Sue"
     r = _diff(l1, l2)
     self.assertEqual(r['deletions'], 1)
     self.assertEqual(r['additions'], 1)
     self.assertEqual(r['jaccard'], 0.5)