def test_binary_unicode_ignore(self):
r"""Binary patterns should not process `\p` references."""
import sre_constants
if PY36_PLUS:
def no_unicode():
"""Should fail on Unicode back reference."""
bre.compile_search(br'EX\p{Lu}MPLE')
# Python 3.6+ fails on invalid back references (which ours are)
# Since this one is not valid in a bytes string, it shouldn't
# be used. It is okay that Python fails on this.
self.assertRaises(sre_constants.error, no_unicode)
else:
pattern = bre.compile_search(br'EX\p{Lu}MPLE')
m = pattern.match(br'EXp{Lu}MPLE')
self.assertTrue(m is not None)
评论列表
文章目录