def test_basic(self): matcher = SegmentDocumentMatcher(iterator(self.first_segments()), iterator(self.second_segments())) tuples = list(matcher.get()) self.assertEqual(len(tuples), 1) self.assertEqual(set(tuples[0][0]), set([self.first2()])) self.assertEqual(set(tuples[0][1]), set([self.second1(), self.second2()]))
def test_end(self): matcher = SegmentDocumentMatcher(iterator(self.first_segments()), iterator(self.third_segments())) tuples = list(matcher.get()) self.assertEqual(len(tuples), 1) self.assertEqual(set(tuples[0][0]), set([self.first3()])) self.assertEqual(set(tuples[0][1]), set([self.third1(), self.third2()]))
def test_empty(self): matcher = SegmentDocumentMatcher(iterator([]), iterator([])) self.assertEqual(list(matcher.get()), [])