aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pyre2/py3/tests/test_mmap.txt
blob: 12ffa97498a4f8e8fcf91c7f776ac812f52d6d9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Testing re2 on buffer object
============================

    >>> import re2
    >>> import mmap
    >>> re2.set_fallback_notification(re2.FALLBACK_EXCEPTION)

    >>> tmp = open("tests/cnn_homepage.dat", "rb+")
    >>> data = mmap.mmap(tmp.fileno(), 0)

    >>> len(list(re2.finditer(b'\\w+', data)))
    14230

    >>> data.close()
    >>> tmp.close()

    >>> re2.set_fallback_notification(re2.FALLBACK_QUIETLY)