Exemplo n.º 1
0
def check_positive_startswith(regexp, char, strict):
    reg = Regexp(regexp, case_sensitive=True, strict=strict)
    assert_true(reg.can_startswith(char),
                '"{}" can start\'s with "{}"'.format(regexp, char))

    reg = Regexp(regexp, case_sensitive=False, strict=strict)
    char = char.upper()
    assert_true(
        reg.can_startswith(char),
        '"{}" (case insensitive) can start\'s with "{}"'.format(regexp, char))
Exemplo n.º 2
0
def check_negative_startswith(regexp, char, strict):
    reg = Regexp(regexp, case_sensitive=True, strict=strict)
    assert_false(
        reg.can_startswith(char),
        '{reg!r} can\'t start\'s with {chr!r}'.format(reg=regexp, chr=char))

    reg = Regexp(regexp, case_sensitive=False, strict=strict)
    char = char.upper()
    assert_false(
        reg.can_startswith(char),
        '{reg!r} (case insensitive) can\'t start\'s with {chr!r}'.format(
            reg=regexp, chr=char))