Exemplo n.º 1
0
def test_process_regexps_invalid():
    # groups missing
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': 'foo'})
    # invalid regex
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': '???(?P<source>.)(?P<message>.)'})
    # invalid placeholder
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': '%(none)(?P<source>.)(?P<message>.)'})
Exemplo n.º 2
0
def test_process_regexps_invalid():
    # groups missing
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': 'foo'})
    # invalid regex
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': '???(?P<source>.)(?P<message>.)'})
    # invalid placeholder
    with pytest.raises(config.ConfigError):
        config._process_regexps({'test': '%(none)(?P<source>.)(?P<message>.)'})
Exemplo n.º 3
0
def test_process_regexps():
    rv = config._process_regexps({
        '__msg': '(?P<message>.)',
        'test': '(?P<source>.)%(msg)'
    })
    assert rv == {'test': re.compile('(?P<source>.)(?P<message>.)')}
Exemplo n.º 4
0
def test_process_regexps():
    rv = config._process_regexps({'__msg': '(?P<message>.)', 'test': '(?P<source>.)%(msg)'})
    assert rv == {'test': re.compile('(?P<source>.)(?P<message>.)')}