Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain patterns are not properly detected in certain scenarios #7

Closed
ratoaq2 opened this issue Nov 26, 2016 · 1 comment
Closed

Chain patterns are not properly detected in certain scenarios #7

ratoaq2 opened this issue Nov 26, 2016 · 1 comment

Comments

@ratoaq2
Copy link
Contributor

ratoaq2 commented Nov 26, 2016

For rebulk version 0.7.6

The minimum I can do is share a failing test case:

def test_matches_7():
    seps_surround = partial(chars_surround, ' .-/')
    rebulk = Rebulk()
    rebulk.regex_defaults(flags=re.IGNORECASE)
    rebulk.defaults(validate_all=True,
                    children=True, private_parent=True,
                    validator={'__parent__': seps_surround})

    rebulk.chain().\
        regex(r'S(?P<season>\d+)').\
        regex(r'[ -](?P<season>\d+)').repeater('*')

    matches = rebulk.matches("Some S01")
    assert len(matches) == 1
    matches[0].value = 1

    matches = rebulk.matches("Some S01-02")
    assert len(matches) == 2
    matches[0].value = 1
    matches[1].value = 2

    matches = rebulk.matches("programs4/Some S01-02")
    assert len(matches) == 2
    matches[0].value = 1
    matches[1].value = 2

    matches = rebulk.matches("programs4/SomeS01middle.S02-03.andS04here")
    assert len(matches) == 2
    matches[0].value = 2
    matches[1].value = 3

    matches = rebulk.matches("Some 02.and.S04-05.here")
    assert len(matches) == 2
    matches[0].value = 4
    matches[1].value = 5

This bug is related to guessit-io/guessit#359

@Toilal
Copy link
Owner

Toilal commented Nov 26, 2016

Thank you, it really helps. I'm debugging at the moment.

@Toilal Toilal closed this as completed in 8b84357 Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants