def test_full(self): words = 'Pizza ? I love deep dish ! Deep dish pizza is great .'.split() query = 'deep dish pizza'.split() spans = snippets._find_query_spans(words, query) assert spans == [(0, 1), (4, 6), (7, 10)]
def test_overlap(self): words = 'pizza pepperoni pizza'.split() query = 'pepperoni pizza'.split() spans = snippets._find_query_spans(words, query) assert spans == [(0, 1), (1, 3)]
def test_single_2(self): words = 'Pizza is great .'.split() query = 'pizza'.split() spans = snippets._find_query_spans(words, query) assert spans == [(0, 1)]
def test_multiple(self): words = """My favorite pizza is deep dish . Deep dish pizza is hella sick pizza bro .""".split() query = 'deep dish pizza'.split() spans = snippets._find_query_spans(words, query) assert spans == [(2, 3), (4, 6), (7, 10), (13, 14)]
def test_single_1(self): words = query = 'pizza'.split() spans = snippets._find_query_spans(words, query) assert spans == [(0, 1)]