File: test_groups.py

package info (click to toggle)
python-pcre2 0.6.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 416 kB
  • sloc: python: 1,986; makefile: 32
file content (14 lines) | stat: -rw-r--r-- 419 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import pytest
import pcre2


def test_match_groups():
    assert pcre2.match("a", "a").groups() == ()
    assert pcre2.match("(a)", "a").groups() == ("a",)

    assert pcre2.match(b"a", b"a").groups() == ()
    assert pcre2.match(b"(a)", b"a").groups() == (b"a",)

    for a in ("\xe0", "\u0430", "\U0001d49c"):
        assert pcre2.match(a, a).groups() == ()
        assert pcre2.match("(%s)" % a, a).groups() == (a,)