def test_get_score(self): table = ListComparer([0, 1], [0, 2], keyfunc, scorefunc) self.assertEqual(0, table.score(0, 0)) self.assertEqual(-1, table.score(1, 1)) self.assertEqual(-1, table.score(1, 0)) self.assertEqual(-2, table.score(0, 1))
def test_get_exact_matches(self): table = ListComparer([0, 1], [0, 1], keyfunc, scorefunc) self.assertEqual([0, 1], list(table.best_matches(0))) self.assertEqual([1, 0], list(table.best_matches(1)))