Example #1
0
def check_positive_must_contain(regexp, char):
    reg = Regexp(regexp, case_sensitive=True)
    assert_true(reg.must_contain(char),
                '"{}" must contain with "{}"'.format(regexp, char))

    reg = Regexp(regexp, case_sensitive=False)
    char = char.upper()
    assert_true(
        reg.must_contain(char),
        '"{}" (case insensitive) must contain with "{}"'.format(regexp, char))
Example #2
0
def check_negative_must_contain(regexp, char):
    reg = Regexp(regexp, case_sensitive=True)
    assert_false(
        reg.must_contain(char),
        '{reg!r} must NOT contain with {chr!r}'.format(reg=regexp, chr=char))

    reg = Regexp(regexp, case_sensitive=False)
    char = char.upper()
    assert_false(
        reg.must_contain(char),
        '{reg!r} (case insensitive) must NOT contain with {chr!r}'.format(
            reg=regexp, chr=char))