def test_ordering(self): task = AbstractTask(info={'url': 'https://bla.pl'}) (result, confidence) = OrderedListVerifier(task, '')([[1, 2, 3, 4], [4, 3, 2, 1]]) self.assertLess(confidence, 1) self.assertGreaterEqual(confidence, 0)
def test_all_same_num(self): entry = [1, 2, 3, 4] task = AbstractTask(info={'url': 'https://bla.pl'}) (result, confidence) = OrderedListVerifier(task, '')([entry, entry, entry]) self.assertEquals(result, entry) self.assertEquals(confidence, 1)
def test_all_same_text(self): entry = ['val1', 'val2', 'val3', 'val4'] task = AbstractTask(info={'url': 'https://bla.pl'}) (result, confidence) = OrderedListVerifier(task, '')([entry, entry, entry]) self.assertEquals(result, entry) self.assertEquals(confidence, 1)
def test_no_standing_out(self): task = AbstractTask(info={'url': 'https://bla.pl'}) (result, confidence) = OrderedListVerifier(task, '')([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) self.assertLess(confidence, 1) self.assertGreaterEqual(confidence, 0)
def test_different_length2(self): entry = [1, 2, 3, 4] task = AbstractTask(info={'url': 'https://bla.pl'}) (result, confidence) = OrderedListVerifier(task, '')([entry + [5], entry, entry]) self.assertEquals(result, entry) self.assertGreaterEqual(confidence, 0) self.assertLess(confidence, 1)