Exemplo n.º 1
0
    def test_caseless_match_fail(self):
        a = "TestString"
        b = "testString1"

        comp = Comparison()
        comp.set_comparator("CaseInsensitiveMatch")
        res = comp.compare(a, b)

        self.assertEqual(res, 0)
Exemplo n.º 2
0
    def test_case_match_match(self):
        a = "TestString"
        b = "TestString"

        comp = Comparison()
        comp.set_comparator("CaseSensitiveMatch")
        res = comp.compare(a, b)

        self.assertEqual(res, 1)
Exemplo n.º 3
0
    def test_damerau_match_fail(self):
        a = "aabc"
        b = "aaaa"
        threshold = 0.7

        comp = Comparison()
        comp.set_comparator("DamerauLevenshtein")
        res = comp.compare(a, b)

        self.assertLess(res, threshold)
Exemplo n.º 4
0
    def test_damerau_match_perfect(self):
        a = "aaaa"
        b = "aaaa"
        threshold = 1

        comp = Comparison()
        comp.set_comparator("DamerauLevenshtein")
        res = comp.compare(a, b)

        self.assertEqual(res, threshold)
Exemplo n.º 5
0
    def test_damerau_match_success(self):
        a = "aaaa"
        b = "aaaa1"
        threshold = 0.7

        comp = Comparison()
        comp.set_comparator("DamerauLevenshtein")
        res = comp.compare(a, b)

        self.assertGreaterEqual(res, threshold)
Exemplo n.º 6
0
    def test_levenshtein_match_success(self):
        a = "aaaa"
        b = "aaaa1"
        threshold = 0.7

        comp = Comparison()
        comp.set_comparator("LevenshteinDistance")
        res = comp.compare(a, b)

        self.assertGreaterEqual(res, threshold)
Exemplo n.º 7
0
 def __init__(self):
     self.processor = Processing()
     self.mappings = None
     self.comparator = Comparison()
     self.comparator.set_comparator(comparison_alg)