def test_pass_precompiled_regex(self):
"""
You can alternatively provide a precompiled regex to the Filter
instead of a string pattern.
"""
# Compile our own pattern so that we can specify the
# ``IGNORECASE`` flag.
# Note that you are responsible for adding the ``UNICODE`` flag
# to your compiled regex!
# noinspection SpellCheckingInspection
pattern = re.compile(r'\btest\b', re.IGNORECASE | re.UNICODE)
self.assertFilterPasses(
self._filter('test march of the TEST penguins', pattern=pattern),
['test', 'TEST'],
)
评论列表
文章目录