def test_single_match(self): uut = BytesSearcher(b'\x05\x05') match = uut.search(b'ascii with \x05\x05 bytes') self.assertIsNotNone(match) self.assertEqual(11, match.start) self.assertEqual(13, match.end)
def test_multi_match(self): uut = BytesSearcher(b'one') match = uut.search(b'one two three two one') self.assertIsNotNone(match) self.assertEqual(0, match.start) self.assertEqual(3, match.end)
def test_no_match(self): uut = BytesSearcher(b'I will never match') self.assertEqual(None, uut.search(b'alpha beta gamma'))