def test_mismatched_types(self): text_searcher = RegexSearcher(u('omicron')) with self.assertRaises(TypeError): text_searcher.search(b'omicron') binary_searcher = RegexSearcher(b'omicron') with self.assertRaises(TypeError): binary_searcher.search(u('omicron'))
def test_single_regex_multi_match(self): uut = RegexSearcher('omicron') match = uut.search('pi delta omicron rho omicron') self.assertIsNotNone(match) self.assertEqual(9, match.start) self.assertEqual(16, match.end)
def test_binary(self): uut = RegexSearcher(b'omicron') match = uut.search(b'omicron pi rho') self.assertIsNotNone(match) self.assertEqual(0, match.start) self.assertEqual(7, match.end)
def test_text(self): uut = RegexSearcher(u('omicron')) match = uut.search(u('omicron pi rho')) self.assertIsNotNone(match) self.assertEqual(0, match.start) self.assertEqual(7, match.end)