30
30
DRAFT7 = SUITE .version (name = "draft7" )
31
31
32
32
33
- def skip_tests_containing_descriptions ( ** kwargs ):
33
+ def skip ( message , ** kwargs ):
34
34
def skipper (test ):
35
- descriptions_and_reasons = kwargs .get (test .subject , {})
36
- return next (
37
- (
38
- reason
39
- for description , reason in descriptions_and_reasons .items ()
40
- if description in test .description
41
- ),
42
- None ,
43
- )
35
+ if all (value in getattr (test , attr ) for attr , value in kwargs .items ()):
36
+ return message
44
37
return skipper
45
38
46
39
@@ -57,15 +50,9 @@ def missing_format(test):
57
50
58
51
is_narrow_build = sys .maxunicode == 2 ** 16 - 1
59
52
if is_narrow_build : # pragma: no cover
60
- narrow_unicode_build = skip_tests_containing_descriptions (
61
- maxLength = {
62
- "supplementary Unicode" :
63
- "Not running surrogate Unicode case, this Python is narrow." ,
64
- },
65
- minLength = {
66
- "supplementary Unicode" :
67
- "Not running surrogate Unicode case, this Python is narrow." ,
68
- },
53
+ narrow_unicode_build = skip (
54
+ message = "Not running surrogate Unicode case, this Python is narrow." ,
55
+ description = "supplementary Unicode" ,
69
56
)
70
57
else :
71
58
def narrow_unicode_build (test ): # pragma: no cover
@@ -87,12 +74,12 @@ def bug(issue=None):
87
74
Validator = Draft3Validator ,
88
75
format_checker = draft3_format_checker ,
89
76
skip = lambda test : (
90
- narrow_unicode_build (test ) or
91
- missing_format (draft3_format_checker )(test ) or
92
- skip_tests_containing_descriptions (
93
- format = {
94
- "case-insensitive T and Z" : "Upstream bug in strict_rfc3339 " ,
95
- } ,
77
+ narrow_unicode_build (test )
78
+ or missing_format (draft3_format_checker )(test )
79
+ or skip (
80
+ message = "Upstream bug in strict_rfc3339" ,
81
+ subject = "format " ,
82
+ description = "case-insensitive T and Z" ,
96
83
)(test )
97
84
),
98
85
)
@@ -106,19 +93,22 @@ def bug(issue=None):
106
93
Validator = Draft4Validator ,
107
94
format_checker = draft4_format_checker ,
108
95
skip = lambda test : (
109
- narrow_unicode_build (test ) or
110
- missing_format (draft4_format_checker )(test ) or
111
- skip_tests_containing_descriptions (
112
- format = {
113
- "case-insensitive T and Z" : "Upstream bug in strict_rfc3339" ,
114
- },
115
- ref = {
116
- "valid tree" : bug (),
117
- },
118
- refRemote = {
119
- "number is valid" : bug (),
120
- "string is invalid" : bug (),
121
- },
96
+ narrow_unicode_build (test )
97
+ or missing_format (draft4_format_checker )(test )
98
+ or skip (
99
+ message = bug (),
100
+ subject = "ref" ,
101
+ case_description = "Recursive references between schemas" ,
102
+ )(test )
103
+ or skip (
104
+ message = bug (),
105
+ subject = "refRemote" ,
106
+ case_description = "base URI change - change folder" ,
107
+ )(test )
108
+ or skip (
109
+ message = "Upstream bug in strict_rfc3339" ,
110
+ subject = "format" ,
111
+ description = "case-insensitive T and Z" ,
122
112
)(test )
123
113
),
124
114
)
@@ -132,19 +122,22 @@ def bug(issue=None):
132
122
Validator = Draft6Validator ,
133
123
format_checker = draft6_format_checker ,
134
124
skip = lambda test : (
135
- narrow_unicode_build (test ) or
136
- missing_format (draft6_format_checker )(test ) or
137
- skip_tests_containing_descriptions (
138
- format = {
139
- "case-insensitive T and Z" : "Upstream bug in strict_rfc3339" ,
140
- },
141
- ref = {
142
- "valid tree" : bug (),
143
- },
144
- refRemote = {
145
- "number is valid" : bug (),
146
- "string is invalid" : bug (),
147
- },
125
+ narrow_unicode_build (test )
126
+ or missing_format (draft6_format_checker )(test )
127
+ or skip (
128
+ message = bug (),
129
+ subject = "ref" ,
130
+ case_description = "Recursive references between schemas" ,
131
+ )(test )
132
+ or skip (
133
+ message = bug (),
134
+ subject = "refRemote" ,
135
+ case_description = "base URI change - change folder" ,
136
+ )(test )
137
+ or skip (
138
+ message = "Upstream bug in strict_rfc3339" ,
139
+ subject = "format" ,
140
+ description = "case-insensitive T and Z" ,
148
141
)(test )
149
142
),
150
143
)
@@ -160,22 +153,20 @@ def bug(issue=None):
160
153
skip = lambda test : (
161
154
narrow_unicode_build (test )
162
155
or missing_format (draft7_format_checker )(test )
163
- or skip_tests_containing_descriptions (
164
- ref = {
165
- "valid tree" : bug (),
166
- },
167
- refRemote = {
168
- "number is valid" : bug (),
169
- "string is invalid" : bug (),
170
- },
156
+ or skip (
157
+ message = bug (),
158
+ subject = "ref" ,
159
+ case_description = "Recursive references between schemas" ,
160
+ )(test )
161
+ or skip (
162
+ message = bug (),
163
+ subject = "refRemote" ,
164
+ case_description = "base URI change - change folder" ,
171
165
)(test )
172
- or skip_tests_containing_descriptions (
173
- ** {
174
- "date-time" : {
175
- "case-insensitive T and Z" :
176
- "Upstream bug in strict_rfc3339" ,
177
- },
178
- }
166
+ or skip (
167
+ message = "Upstream bug in strict_rfc3339" ,
168
+ subject = "date-time" ,
169
+ description = "case-insensitive T and Z" ,
179
170
)(test )
180
171
),
181
172
)
0 commit comments