77import pytest
88
99# this package
10- from coverage_pyver_pragma import make_not_exclude_regex , make_regexes
10+ from coverage_pyver_pragma import make_not_exclude_regexs , make_regexes
1111
1212
1313def test_not_version_regex ():
1414
15- not_version_regex = make_not_exclude_regex ("Linux" , "CPython" ).pattern
15+ not_version_regex = make_not_exclude_regexs ("Linux" , "CPython" )[ 0 ] .pattern
1616 print (not_version_regex )
1717
1818 counter = 1
@@ -37,7 +37,6 @@ def test_not_version_regex():
3737 raise AssertionError (f"[{ counter } FAIL: { test_string } ]" )
3838 counter += 1
3939
40- # TODO Regex for # pragma: no cover etc with nothing after it
4140 for comment_string in ['#' , "# " , "# " , "#\t " , "# \t " , "# \t " , "#\t " ]:
4241 for pragma_string in ["pragma" , "PRAGMA" ]:
4342 for post_pragma_space in ['' , ':' , ": " , ":\t " , " " ]:
@@ -46,7 +45,25 @@ def test_not_version_regex():
4645 for cover_string in ["cover" , "COVER" ]:
4746 for post_cover_space in [' ' ]:
4847 # ['', ' ', "\t", " "]: # TODO: This regex is picky about the space here
49- for post_cover_text in ['' , "abcdefg" , "hello world" ]:
48+ for post_cover_text in ["abcdefg" , "hello world" ]:
49+ test_string = f"{ comment_string } { pragma_string } { post_pragma_space } { no_string } { post_no_space } { cover_string } { post_cover_space } { post_cover_text } "
50+ # print(f"[{counter} TESTING: {test_string}]")
51+
52+ if re .match (not_version_regex , test_string ) is None :
53+ raise AssertionError (f"[{ counter } FAIL: { test_string } ]" )
54+ counter += 1
55+
56+ not_version_regex = make_not_exclude_regexs ("Linux" , "CPython" )[1 ].pattern
57+ print (not_version_regex )
58+
59+ for comment_string in ['#' , "# " , "# " , "#\t " , "# \t " , "# \t " , "#\t " ]:
60+ for pragma_string in ["pragma" , "PRAGMA" ]:
61+ for post_pragma_space in ['' , ':' , ": " , ":\t " , " " ]:
62+ for no_string in ["no" , "NO" ]:
63+ for post_no_space in ['' , ' ' , "\t " , " " ]:
64+ for cover_string in ["cover" , "COVER" ]:
65+ for post_cover_space in ['' ]:
66+ for post_cover_text in ['' ]:
5067 test_string = f"{ comment_string } { pragma_string } { post_pragma_space } { no_string } { post_no_space } { cover_string } { post_cover_space } { post_cover_text } "
5168 # print(f"[{counter} TESTING: {test_string}]")
5269
0 commit comments