Python pygments.util.unirange() Examples

The following are 1 code examples of pygments.util.unirange(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygments.util , or try the search function .
Example #1
Source File: test_util.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_unirange():
    first_non_bmp = u'\U00010000'
    r = re.compile(util.unirange(0x10000, 0x20000))
    m = r.match(first_non_bmp)
    assert m
    assert m.end() == len(first_non_bmp)
    assert not r.match(u'\uffff')
    assert not r.match(u'xxx')
    # Tests that end is inclusive
    r = re.compile(util.unirange(0x10000, 0x10000) + '+')
    # Tests that the plus works for the entire unicode point, if narrow
    # build
    m = r.match(first_non_bmp * 2)
    assert m
    assert m.end() == len(first_non_bmp) * 2