def check_positive_must_startswith(regexp, char, strict): reg = Regexp(regexp, case_sensitive=True, strict=strict) assert_true(reg.must_startswith(char), '"{}" MUST start\'s with "{}"'.format(regexp, char)) reg = Regexp(regexp, case_sensitive=False, strict=strict) char = char.upper() assert_true( reg.must_startswith(char), '"{}" (case insensitive) MUST start\'s with "{}"'.format(regexp, char))
def check_negative_must_startswith(regexp, char, strict): reg = Regexp(regexp, case_sensitive=True, strict=strict) assert_false( reg.must_startswith(char), '{reg!r} MUST NOT start\'s with {chr!r}'.format(reg=regexp, chr=char)) reg = Regexp(regexp, case_sensitive=False, strict=strict) char = char.upper() assert_false( reg.must_startswith(char), '{reg!r} (case insensitive) MUST NOT start\'s with {chr!r}'.format( reg=regexp, chr=char))