7
7
import pytest
8
8
9
9
# 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
11
11
12
12
13
13
def test_not_version_regex ():
14
14
15
- not_version_regex = make_not_exclude_regex ("Linux" , "CPython" ).pattern
15
+ not_version_regex = make_not_exclude_regexs ("Linux" , "CPython" )[ 0 ] .pattern
16
16
print (not_version_regex )
17
17
18
18
counter = 1
@@ -37,7 +37,6 @@ def test_not_version_regex():
37
37
raise AssertionError (f"[{ counter } FAIL: { test_string } ]" )
38
38
counter += 1
39
39
40
- # TODO Regex for # pragma: no cover etc with nothing after it
41
40
for comment_string in ['#' , "# " , "# " , "#\t " , "# \t " , "# \t " , "#\t " ]:
42
41
for pragma_string in ["pragma" , "PRAGMA" ]:
43
42
for post_pragma_space in ['' , ':' , ": " , ":\t " , " " ]:
@@ -46,7 +45,25 @@ def test_not_version_regex():
46
45
for cover_string in ["cover" , "COVER" ]:
47
46
for post_cover_space in [' ' ]:
48
47
# ['', ' ', "\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 ['' ]:
50
67
test_string = f"{ comment_string } { pragma_string } { post_pragma_space } { no_string } { post_no_space } { cover_string } { post_cover_space } { post_cover_text } "
51
68
# print(f"[{counter} TESTING: {test_string}]")
52
69
0 commit comments