You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey everyone I am trying to test a regex pattern using regex package and currently the current test for the test parameters is failing:
("<ACCESSION-NUM>0000915913-23-000148", None), # three typos (should fail)
Full Test:
importpytestimportregex# Define the regex pattern with fuzzy matchingaccession_fuzzy_regex_pattern=r"<(?:ACCESSION-NUMBER){e<=2}>\s*(\d+-\d+-\d+)"# Test cases@pytest.mark.parametrize( ("test_input", "expected"), [ ("<ACCESSION-NUMBER>0000915913-23-000148","0000915913-23-000148", ), # exact match ("<ACCESSION-NUMBE>0000915913-23-000148", "0000915913-23-000148"), # one typo ("<ACCESSION-NUMB>0000915913-23-000148", "0000915913-23-000148"), # two typos ("<ACCESSION-NUM>0000915913-23-000148", None), # three typos (should fail) ("<ACCSSION-NUMBER>0000915913-23-000148",None, ), # missing one character (should fail) ("<ACCESSION-NUMBER>0000915913-23-", None), # incomplete number (should fail) ("<ACCESSION-NUMBER>", None), # no number (should fail) ("0000915913-23-000148", None), # no tag (should fail) ],)deftest_accession_number_regex(test_input, expected):
"""Test the accession number regex pattern."""match=regex.search(accession_fuzzy_regex_pattern, test_input)
ifmatch:
group_one=match.group(1)
assertgroup_one==expectedelse:
assertexpectedisNone
The failing test case (#4) has 3 typos so it should not match but for some reason it matches and so does deleted more characters.
The text was updated successfully, but these errors were encountered:
Hey everyone I am trying to test a regex pattern using regex package and currently the current test for the test parameters is failing:
Full Test:
The failing test case (#4) has 3 typos so it should not match but for some reason it matches and so does deleted more characters.
The text was updated successfully, but these errors were encountered: