pytest-check icon indicating copy to clipboard operation
pytest-check copied to clipboard

Include a `check.match` and `check.not_match` for regex comparison

Open LecrisUT opened this issue 1 year ago • 1 comments

Should be straightforward as:

def match(regex, string, msg=""):
    __tracebackhide__ = True
    if regex.match(string):
        return True
    else:
        log_failure(f"check {regex}.match({string})", msg)
        return False

In the meantime check.is_true could also be used.

LecrisUT avatar May 05 '24 08:05 LecrisUT

This might be cool. I'd consider a PR.

okken avatar Aug 27 '24 15:08 okken