# -*- coding: utf-8 -*-
import pytest

import ioex.reex


@pytest.mark.parametrize(('source', 'repl', 'expected'), [
    ['(?P<a>a)', lambda n: n.upper(), '(?P<A>a)'],
    ['(?P<a>a(?P<a1>1))', lambda n: n.upper(), '(?P<A>a(?P<A1>1))'],
    ['(?P<a>a)(?P<b>b)', lambda n: n.upper(), '(?P<A>a)(?P<B>b)'],
])
def test_rename_groups(source, repl, expected):
    assert expected == ioex.reex.rename_groups(source, repl)

6c0f61895f39ce63bd7de6a35d42987046aa10f6
<mask token>

<mask token>


@pytest.mark.parametrize(('source', 'repl', 'expected'), [['(?P<a>a)', lambda
    n: n.upper(), '(?P<A>a)'], ['(?P<a>a(?P<a1>1))', lambda n: n.upper(),
    '(?P<A>a(?P<A1>1))'], ['(?P<a>a)(?P<b>b)', lambda n: n.upper(),
    '(?P<A>a)(?P<B>b)']])
def test_rename_groups(source, repl, expected):
    assert expected == ioex.reex.rename_groups(source, repl)

import pytest
import ioex.reex


@pytest.mark.parametrize(('source', 'repl', 'expected'), [['(?P<a>a)', lambda
    n: n.upper(), '(?P<A>a)'], ['(?P<a>a(?P<a1>1))', lambda n: n.upper(),
    '(?P<A>a(?P<A1>1))'], ['(?P<a>a)(?P<b>b)', lambda n: n.upper(),
    '(?P<A>a)(?P<B>b)']])
def test_rename_groups(source, repl, expected):
    assert expected == ioex.reex.rename_groups(source, repl)

# -*- coding: utf-8 -*-
import pytest

import ioex.reex


@pytest.mark.parametrize(('source', 'repl', 'expected'), [
    ['(?P<a>a)', lambda n: n.upper(), '(?P<A>a)'],
    ['(?P<a>a(?P<a1>1))', lambda n: n.upper(), '(?P<A>a(?P<A1>1))'],
    ['(?P<a>a)(?P<b>b)', lambda n: n.upper(), '(?P<A>a)(?P<B>b)'],
])
def test_rename_groups(source, repl, expected):
    assert expected == ioex.reex.rename_groups(source, repl)
