schemathesis 3.39.7__py3-none-any.whl → 3.39.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- schemathesis/_hypothesis.py +13 -10
- schemathesis/cli/output/default.py +2 -2
- schemathesis/failures.py +2 -1
- schemathesis/generation/coverage.py +10 -5
- schemathesis/internal/deprecation.py +1 -2
- schemathesis/models.py +1 -1
- schemathesis/specs/openapi/checks.py +15 -10
- schemathesis/specs/openapi/loaders.py +1 -2
- schemathesis/specs/openapi/parameters.py +1 -1
- schemathesis/specs/openapi/patterns.py +170 -2
- schemathesis/stateful/state_machine.py +2 -1
- {schemathesis-3.39.7.dist-info → schemathesis-3.39.9.dist-info}/METADATA +1 -1
- {schemathesis-3.39.7.dist-info → schemathesis-3.39.9.dist-info}/RECORD +16 -16
- {schemathesis-3.39.7.dist-info → schemathesis-3.39.9.dist-info}/WHEEL +0 -0
- {schemathesis-3.39.7.dist-info → schemathesis-3.39.9.dist-info}/entry_points.txt +0 -0
- {schemathesis-3.39.7.dist-info → schemathesis-3.39.9.dist-info}/licenses/LICENSE +0 -0
schemathesis/_hypothesis.py
CHANGED
@@ -332,16 +332,19 @@ def _iter_coverage_cases(
|
|
332
332
|
if operation.query:
|
333
333
|
container = template["query"]
|
334
334
|
for parameter in operation.query:
|
335
|
-
value
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
335
|
+
# Could be absent if value schema can't be negated
|
336
|
+
# I.e. contains just `default` value without any other keywords
|
337
|
+
value = container.get(parameter.name, NOT_SET)
|
338
|
+
if value is not NOT_SET:
|
339
|
+
case = operation.make_case(**{**template, "query": {**container, parameter.name: [value, value]}})
|
340
|
+
case.data_generation_method = DataGenerationMethod.negative
|
341
|
+
case.meta = _make_meta(
|
342
|
+
description=f"Duplicate `{parameter.name}` query parameter",
|
343
|
+
location=None,
|
344
|
+
parameter=parameter.name,
|
345
|
+
parameter_location="query",
|
346
|
+
)
|
347
|
+
yield case
|
345
348
|
# Generate missing required parameters
|
346
349
|
for parameter in operation.iter_parameters():
|
347
350
|
if parameter.is_required and parameter.location != "path":
|
@@ -125,7 +125,7 @@ def get_summary_output(event: events.Finished) -> tuple[str, str]:
|
|
125
125
|
message = "Empty test suite"
|
126
126
|
color = "yellow"
|
127
127
|
else:
|
128
|
-
message = f'
|
128
|
+
message = f"{', '.join(parts)} in {event.running_time:.2f}s"
|
129
129
|
if event.has_failures or event.has_errors:
|
130
130
|
color = "red"
|
131
131
|
elif event.skipped_count > 0:
|
@@ -176,7 +176,7 @@ def display_errors(context: ExecutionContext, event: events.Finished) -> None:
|
|
176
176
|
fg="red",
|
177
177
|
)
|
178
178
|
click.secho(
|
179
|
-
f"\nNeed more help?\n
|
179
|
+
f"\nNeed more help?\n Join our Discord server: {DISCORD_LINK}",
|
180
180
|
fg="red",
|
181
181
|
)
|
182
182
|
|
schemathesis/failures.py
CHANGED
@@ -93,8 +93,9 @@ class JSONDecodeErrorContext(FailureContext):
|
|
93
93
|
|
94
94
|
@classmethod
|
95
95
|
def from_exception(cls, exc: JSONDecodeError) -> JSONDecodeErrorContext:
|
96
|
+
message = f"Response must be valid JSON with 'Content-Type: application/json' header:\n\n {exc}"
|
96
97
|
return cls(
|
97
|
-
message=
|
98
|
+
message=message,
|
98
99
|
validation_message=exc.msg,
|
99
100
|
document=exc.doc,
|
100
101
|
position=exc.pos,
|
@@ -194,6 +194,10 @@ class CoverageContext:
|
|
194
194
|
re.compile(pattern)
|
195
195
|
except re.error:
|
196
196
|
raise Unsatisfiable from None
|
197
|
+
if "minLength" in schema or "maxLength" in schema:
|
198
|
+
min_length = schema.get("minLength")
|
199
|
+
max_length = schema.get("maxLength")
|
200
|
+
pattern = update_quantifier(pattern, min_length, max_length)
|
197
201
|
return cached_draw(st.from_regex(pattern))
|
198
202
|
if (keys == ["items", "type"] or keys == ["items", "minItems", "type"]) and isinstance(schema["items"], dict):
|
199
203
|
items = schema["items"]
|
@@ -433,7 +437,12 @@ def cover_schema_iter(
|
|
433
437
|
elif key == "required":
|
434
438
|
template = template or ctx.generate_from_schema(_get_template_schema(schema, "object"))
|
435
439
|
yield from _negative_required(ctx, template, value)
|
436
|
-
elif
|
440
|
+
elif (
|
441
|
+
key == "additionalProperties"
|
442
|
+
and not value
|
443
|
+
and "pattern" not in schema
|
444
|
+
and schema.get("type") in ["object", None]
|
445
|
+
):
|
437
446
|
template = template or ctx.generate_from_schema(_get_template_schema(schema, "object"))
|
438
447
|
yield NegativeValue(
|
439
448
|
{**template, UNKNOWN_PROPERTY_KEY: UNKNOWN_PROPERTY_VALUE},
|
@@ -514,11 +523,7 @@ def _positive_string(ctx: CoverageContext, schema: dict) -> Generator[GeneratedV
|
|
514
523
|
# Default positive value
|
515
524
|
yield PositiveValue(ctx.generate_from_schema(schema), description="Valid string")
|
516
525
|
elif "pattern" in schema:
|
517
|
-
# Without merging `maxLength` & `minLength` into a regex it is problematic
|
518
|
-
# to generate a valid value as the unredlying machinery will resort to filtering
|
519
|
-
# and it is unlikely that it will generate a string of that length
|
520
526
|
yield PositiveValue(ctx.generate_from_schema(schema), description="Valid string")
|
521
|
-
return
|
522
527
|
|
523
528
|
seen = set()
|
524
529
|
|
@@ -4,8 +4,7 @@ from typing import Any, Callable
|
|
4
4
|
|
5
5
|
def _warn_deprecation(*, kind: str, thing: str, removed_in: str, replacement: str) -> None:
|
6
6
|
warnings.warn(
|
7
|
-
f"{kind} `{thing}` is deprecated and will be removed in Schemathesis {removed_in}. "
|
8
|
-
f"Use {replacement} instead.",
|
7
|
+
f"{kind} `{thing}` is deprecated and will be removed in Schemathesis {removed_in}. Use {replacement} instead.",
|
9
8
|
DeprecationWarning,
|
10
9
|
stacklevel=1,
|
11
10
|
)
|
schemathesis/models.py
CHANGED
@@ -560,7 +560,7 @@ class Case:
|
|
560
560
|
sanitize_response(response)
|
561
561
|
code_message = self._get_code_message(code_sample_style, response.request, verify=verify)
|
562
562
|
raise exception_cls(
|
563
|
-
f"{formatted}\n\n
|
563
|
+
f"{formatted}\n\n{code_message}",
|
564
564
|
causes=tuple(failed_checks),
|
565
565
|
)
|
566
566
|
|
@@ -32,10 +32,15 @@ if TYPE_CHECKING:
|
|
32
32
|
from ...transports.responses import GenericResponse
|
33
33
|
|
34
34
|
|
35
|
+
def is_unexpected_http_status_case(case: Case) -> bool:
|
36
|
+
# Skip checks for requests using HTTP methods not defined in the API spec
|
37
|
+
return bool(case.meta and case.meta.description and case.meta.description.startswith("Unspecified HTTP method"))
|
38
|
+
|
39
|
+
|
35
40
|
def status_code_conformance(ctx: CheckContext, response: GenericResponse, case: Case) -> bool | None:
|
36
41
|
from .schemas import BaseOpenAPISchema
|
37
42
|
|
38
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
43
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
39
44
|
return True
|
40
45
|
responses = case.operation.definition.raw.get("responses", {})
|
41
46
|
# "default" can be used as the default response object for all HTTP codes that are not covered individually
|
@@ -66,7 +71,7 @@ def _expand_responses(responses: dict[str | int, Any]) -> Generator[int, None, N
|
|
66
71
|
def content_type_conformance(ctx: CheckContext, response: GenericResponse, case: Case) -> bool | None:
|
67
72
|
from .schemas import BaseOpenAPISchema
|
68
73
|
|
69
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
74
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
70
75
|
return True
|
71
76
|
documented_content_types = case.operation.schema.get_content_types(case.operation, response)
|
72
77
|
if not documented_content_types:
|
@@ -124,7 +129,7 @@ def response_headers_conformance(ctx: CheckContext, response: GenericResponse, c
|
|
124
129
|
from .parameters import OpenAPI20Parameter, OpenAPI30Parameter
|
125
130
|
from .schemas import BaseOpenAPISchema, OpenApi30, _maybe_raise_one_or_more
|
126
131
|
|
127
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
132
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
128
133
|
return True
|
129
134
|
resolved = case.operation.schema.get_headers(case.operation, response)
|
130
135
|
if not resolved:
|
@@ -209,7 +214,7 @@ def _coerce_header_value(value: str, schema: dict[str, Any]) -> str | int | floa
|
|
209
214
|
def response_schema_conformance(ctx: CheckContext, response: GenericResponse, case: Case) -> bool | None:
|
210
215
|
from .schemas import BaseOpenAPISchema
|
211
216
|
|
212
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
217
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
213
218
|
return True
|
214
219
|
return case.operation.validate_response(response)
|
215
220
|
|
@@ -217,7 +222,7 @@ def response_schema_conformance(ctx: CheckContext, response: GenericResponse, ca
|
|
217
222
|
def negative_data_rejection(ctx: CheckContext, response: GenericResponse, case: Case) -> bool | None:
|
218
223
|
from .schemas import BaseOpenAPISchema
|
219
224
|
|
220
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
225
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
221
226
|
return True
|
222
227
|
|
223
228
|
config = ctx.config.negative_data_rejection
|
@@ -245,7 +250,7 @@ def negative_data_rejection(ctx: CheckContext, response: GenericResponse, case:
|
|
245
250
|
def positive_data_acceptance(ctx: CheckContext, response: GenericResponse, case: Case) -> bool | None:
|
246
251
|
from .schemas import BaseOpenAPISchema
|
247
252
|
|
248
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
253
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
249
254
|
return True
|
250
255
|
|
251
256
|
config = ctx.config.positive_data_acceptance
|
@@ -283,7 +288,7 @@ def missing_required_header(ctx: CheckContext, response: GenericResponse, case:
|
|
283
288
|
config = ctx.config.missing_required_header
|
284
289
|
allowed_statuses = expand_status_codes(config.allowed_statuses or [])
|
285
290
|
if response.status_code not in allowed_statuses:
|
286
|
-
allowed = f"Allowed statuses: {', '.join(map(str,allowed_statuses))}"
|
291
|
+
allowed = f"Allowed statuses: {', '.join(map(str, allowed_statuses))}"
|
287
292
|
raise AssertionError(f"Unexpected response status for a missing header: {response.status_code}\n{allowed}")
|
288
293
|
return None
|
289
294
|
|
@@ -333,7 +338,7 @@ def use_after_free(ctx: CheckContext, response: GenericResponse, original: Case)
|
|
333
338
|
from ...transports.responses import get_reason
|
334
339
|
from .schemas import BaseOpenAPISchema
|
335
340
|
|
336
|
-
if not isinstance(original.operation.schema, BaseOpenAPISchema):
|
341
|
+
if not isinstance(original.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(original):
|
337
342
|
return True
|
338
343
|
if response.status_code == 404 or not original.source or response.status_code >= 500:
|
339
344
|
return None
|
@@ -373,7 +378,7 @@ def ensure_resource_availability(ctx: CheckContext, response: GenericResponse, o
|
|
373
378
|
from ...transports.responses import get_reason
|
374
379
|
from .schemas import BaseOpenAPISchema
|
375
380
|
|
376
|
-
if not isinstance(original.operation.schema, BaseOpenAPISchema):
|
381
|
+
if not isinstance(original.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(original):
|
377
382
|
return True
|
378
383
|
if (
|
379
384
|
# Response indicates a client error, even though all available parameters were taken from links
|
@@ -416,7 +421,7 @@ def ignored_auth(ctx: CheckContext, response: GenericResponse, case: Case) -> bo
|
|
416
421
|
"""Check if an operation declares authentication as a requirement but does not actually enforce it."""
|
417
422
|
from .schemas import BaseOpenAPISchema
|
418
423
|
|
419
|
-
if not isinstance(case.operation.schema, BaseOpenAPISchema):
|
424
|
+
if not isinstance(case.operation.schema, BaseOpenAPISchema) or is_unexpected_http_status_case(case):
|
420
425
|
return True
|
421
426
|
security_parameters = _get_security_parameters(case.operation)
|
422
427
|
# Authentication is required for this API operation and response is successful
|
@@ -432,8 +432,7 @@ For more details, check the Open API documentation: {DOC_ENTRY}
|
|
432
432
|
|
433
433
|
Please, stringify the following status codes:"""
|
434
434
|
NON_STRING_OBJECT_KEY_MESSAGE = (
|
435
|
-
"The Open API specification requires all keys in the schema to be strings. "
|
436
|
-
"You have some keys that are not strings."
|
435
|
+
"The Open API specification requires all keys in the schema to be strings. You have some keys that are not strings."
|
437
436
|
)
|
438
437
|
|
439
438
|
|
@@ -359,7 +359,7 @@ MISSING_SCHEMA_OR_CONTENT_MESSAGE = (
|
|
359
359
|
)
|
360
360
|
|
361
361
|
INVALID_SCHEMA_MESSAGE = (
|
362
|
-
'Can not generate data for {location} parameter "{name}"!
|
362
|
+
'Can not generate data for {location} parameter "{name}"! Its schema should be an object, got {schema}'
|
363
363
|
)
|
364
364
|
|
365
365
|
|
@@ -66,9 +66,177 @@ def _handle_parsed_pattern(parsed: list, pattern: str, min_length: int | None, m
|
|
66
66
|
)
|
67
67
|
+ trailing_anchor
|
68
68
|
)
|
69
|
+
elif (
|
70
|
+
len(parsed) > 3
|
71
|
+
and parsed[0][0] == ANCHOR
|
72
|
+
and parsed[-1][0] == ANCHOR
|
73
|
+
and all(op == LITERAL or op in REPEATS for op, _ in parsed[1:-1])
|
74
|
+
):
|
75
|
+
return _handle_anchored_pattern(parsed, pattern, min_length, max_length)
|
69
76
|
return pattern
|
70
77
|
|
71
78
|
|
79
|
+
def _handle_anchored_pattern(parsed: list, pattern: str, min_length: int | None, max_length: int | None) -> str:
|
80
|
+
"""Update regex pattern with multiple quantified patterns to satisfy length constraints."""
|
81
|
+
# Extract anchors
|
82
|
+
leading_anchor_length = _get_anchor_length(parsed[0][1])
|
83
|
+
trailing_anchor_length = _get_anchor_length(parsed[-1][1])
|
84
|
+
leading_anchor = pattern[:leading_anchor_length]
|
85
|
+
trailing_anchor = pattern[-trailing_anchor_length:]
|
86
|
+
|
87
|
+
pattern_parts = parsed[1:-1]
|
88
|
+
|
89
|
+
# Adjust length constraints by subtracting fixed literals length
|
90
|
+
fixed_length = sum(1 for op, _ in pattern_parts if op == LITERAL)
|
91
|
+
if min_length is not None:
|
92
|
+
min_length -= fixed_length
|
93
|
+
if min_length < 0:
|
94
|
+
return pattern
|
95
|
+
if max_length is not None:
|
96
|
+
max_length -= fixed_length
|
97
|
+
if max_length < 0:
|
98
|
+
return pattern
|
99
|
+
|
100
|
+
# Extract only min/max bounds from quantified parts
|
101
|
+
quantifier_bounds = [value[:2] for op, value in pattern_parts if op in REPEATS]
|
102
|
+
|
103
|
+
if not quantifier_bounds:
|
104
|
+
return pattern
|
105
|
+
|
106
|
+
length_distribution = _distribute_length_constraints(quantifier_bounds, min_length, max_length)
|
107
|
+
if not length_distribution:
|
108
|
+
return pattern
|
109
|
+
|
110
|
+
# Rebuild pattern with updated quantifiers
|
111
|
+
result = leading_anchor
|
112
|
+
current_position = leading_anchor_length
|
113
|
+
distribution_idx = 0
|
114
|
+
|
115
|
+
for op, value in pattern_parts:
|
116
|
+
if op == LITERAL:
|
117
|
+
if pattern[current_position] == "\\":
|
118
|
+
# Escaped value
|
119
|
+
current_position += 2
|
120
|
+
result += "\\"
|
121
|
+
else:
|
122
|
+
current_position += 1
|
123
|
+
result += chr(value)
|
124
|
+
else:
|
125
|
+
new_min, new_max = length_distribution[distribution_idx]
|
126
|
+
next_position = _find_quantified_end(pattern, current_position)
|
127
|
+
quantified_segment = pattern[current_position:next_position]
|
128
|
+
_, _, subpattern = value
|
129
|
+
new_value = (new_min, new_max, subpattern)
|
130
|
+
|
131
|
+
result += _update_quantifier(op, new_value, quantified_segment, new_min, new_max)
|
132
|
+
current_position = next_position
|
133
|
+
distribution_idx += 1
|
134
|
+
|
135
|
+
return result + trailing_anchor
|
136
|
+
|
137
|
+
|
138
|
+
def _find_quantified_end(pattern: str, start: int) -> int:
|
139
|
+
"""Find the end position of current quantified part."""
|
140
|
+
char_class_level = 0
|
141
|
+
group_level = 0
|
142
|
+
|
143
|
+
for i in range(start, len(pattern)):
|
144
|
+
char = pattern[i]
|
145
|
+
|
146
|
+
# Handle character class nesting
|
147
|
+
if char == "[":
|
148
|
+
char_class_level += 1
|
149
|
+
elif char == "]":
|
150
|
+
char_class_level -= 1
|
151
|
+
|
152
|
+
# Handle group nesting
|
153
|
+
elif char == "(":
|
154
|
+
group_level += 1
|
155
|
+
elif char == ")":
|
156
|
+
group_level -= 1
|
157
|
+
|
158
|
+
# Only process quantifiers when we're not inside any nested structure
|
159
|
+
elif char_class_level == 0 and group_level == 0:
|
160
|
+
if char in "*+?":
|
161
|
+
return i + 1
|
162
|
+
elif char == "{":
|
163
|
+
# Find matching }
|
164
|
+
while i < len(pattern) and pattern[i] != "}":
|
165
|
+
i += 1
|
166
|
+
return i + 1
|
167
|
+
|
168
|
+
return len(pattern)
|
169
|
+
|
170
|
+
|
171
|
+
def _distribute_length_constraints(
|
172
|
+
bounds: list[tuple[int, int]], min_length: int | None, max_length: int | None
|
173
|
+
) -> list[tuple[int, int]] | None:
|
174
|
+
"""Distribute length constraints among quantified pattern parts."""
|
175
|
+
# Handle exact length case with dynamic programming
|
176
|
+
if min_length == max_length:
|
177
|
+
assert min_length is not None
|
178
|
+
target = min_length
|
179
|
+
dp: dict[tuple[int, int], list[tuple[int, ...]] | None] = {}
|
180
|
+
|
181
|
+
def find_valid_combination(pos: int, remaining: int) -> list[tuple[int, ...]] | None:
|
182
|
+
if (pos, remaining) in dp:
|
183
|
+
return dp[(pos, remaining)]
|
184
|
+
|
185
|
+
if pos == len(bounds):
|
186
|
+
return [()] if remaining == 0 else None
|
187
|
+
|
188
|
+
max_len: int
|
189
|
+
min_len, max_len = bounds[pos]
|
190
|
+
if max_len == MAXREPEAT:
|
191
|
+
max_len = remaining + 1
|
192
|
+
else:
|
193
|
+
max_len += 1
|
194
|
+
|
195
|
+
# Try each possible length for current quantifier
|
196
|
+
for length in range(min_len, max_len):
|
197
|
+
rest = find_valid_combination(pos + 1, remaining - length)
|
198
|
+
if rest is not None:
|
199
|
+
dp[(pos, remaining)] = [(length,) + r for r in rest]
|
200
|
+
return dp[(pos, remaining)]
|
201
|
+
|
202
|
+
dp[(pos, remaining)] = None
|
203
|
+
return None
|
204
|
+
|
205
|
+
distribution = find_valid_combination(0, target)
|
206
|
+
if distribution:
|
207
|
+
return [(length, length) for length in distribution[0]]
|
208
|
+
return None
|
209
|
+
|
210
|
+
# Handle range case by distributing min/max bounds
|
211
|
+
result = []
|
212
|
+
remaining_min = min_length or 0
|
213
|
+
remaining_max = max_length or MAXREPEAT
|
214
|
+
|
215
|
+
for min_repeat, max_repeat in bounds:
|
216
|
+
if remaining_min > 0:
|
217
|
+
part_min = min(max_repeat, max(min_repeat, remaining_min))
|
218
|
+
else:
|
219
|
+
part_min = min_repeat
|
220
|
+
|
221
|
+
if remaining_max < MAXREPEAT:
|
222
|
+
part_max = min(max_repeat, remaining_max)
|
223
|
+
else:
|
224
|
+
part_max = max_repeat
|
225
|
+
|
226
|
+
if part_min > part_max:
|
227
|
+
return None
|
228
|
+
|
229
|
+
result.append((part_min, part_max))
|
230
|
+
|
231
|
+
remaining_min = max(0, remaining_min - part_min)
|
232
|
+
remaining_max -= part_max if part_max != MAXREPEAT else 0
|
233
|
+
|
234
|
+
if remaining_min > 0 or remaining_max < 0:
|
235
|
+
return None
|
236
|
+
|
237
|
+
return result
|
238
|
+
|
239
|
+
|
72
240
|
def _get_anchor_length(node_type: int) -> int:
|
73
241
|
"""Determine the length of the anchor based on its type."""
|
74
242
|
if node_type in {sre.AT_BEGINNING_STRING, sre.AT_END_STRING, sre.AT_BOUNDARY, sre.AT_NON_BOUNDARY}:
|
@@ -93,13 +261,13 @@ def _handle_repeat_quantifier(
|
|
93
261
|
min_length, max_length = _build_size(min_repeat, max_repeat, min_length, max_length)
|
94
262
|
if min_length > max_length:
|
95
263
|
return pattern
|
96
|
-
return f"({_strip_quantifier(pattern)})" + _build_quantifier(min_length, max_length)
|
264
|
+
return f"({_strip_quantifier(pattern).strip(')(')})" + _build_quantifier(min_length, max_length)
|
97
265
|
|
98
266
|
|
99
267
|
def _handle_literal_or_in_quantifier(pattern: str, min_length: int | None, max_length: int | None) -> str:
|
100
268
|
"""Handle literal or character class quantifiers."""
|
101
269
|
min_length = 1 if min_length is None else max(min_length, 1)
|
102
|
-
return f"({pattern})" + _build_quantifier(min_length, max_length)
|
270
|
+
return f"({pattern.strip(')(')})" + _build_quantifier(min_length, max_length)
|
103
271
|
|
104
272
|
|
105
273
|
def _build_quantifier(minimum: int | None, maximum: int | None) -> str:
|
@@ -169,6 +169,7 @@ class APIStateMachine(RuleBasedStateMachine):
|
|
169
169
|
kwargs = self.get_call_kwargs(case)
|
170
170
|
start = time.monotonic()
|
171
171
|
response = self.call(case, **kwargs)
|
172
|
+
self._transport_kwargs = kwargs
|
172
173
|
elapsed = time.monotonic() - start
|
173
174
|
self.after_call(response, case)
|
174
175
|
self.validate_response(response, case, additional_checks=(use_after_free,))
|
@@ -297,7 +298,7 @@ class APIStateMachine(RuleBasedStateMachine):
|
|
297
298
|
all provided checks rather than only the first encountered exception.
|
298
299
|
"""
|
299
300
|
__tracebackhide__ = True
|
300
|
-
case.validate_response(response, additional_checks=additional_checks)
|
301
|
+
case.validate_response(response, additional_checks=additional_checks, transport_kwargs=self._transport_kwargs)
|
301
302
|
|
302
303
|
def store_result(self, response: GenericResponse, case: Case, elapsed: float) -> StepResult:
|
303
304
|
return StepResult(response, case, elapsed)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: schemathesis
|
3
|
-
Version: 3.39.
|
3
|
+
Version: 3.39.9
|
4
4
|
Summary: Property-based testing framework for Open API and GraphQL based apps
|
5
5
|
Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
|
6
6
|
Project-URL: Changelog, https://schemathesis.readthedocs.io/en/stable/changelog.html
|
@@ -1,7 +1,7 @@
|
|
1
1
|
schemathesis/__init__.py,sha256=UW2Bq8hDDkcBeAAA7PzpBFXkOOxkmHox-mfQwzHDjL0,1914
|
2
2
|
schemathesis/_compat.py,sha256=y4RZd59i2NCnZ91VQhnKeMn_8t3SgvLOk2Xm8nymUHY,1837
|
3
3
|
schemathesis/_dependency_versions.py,sha256=pjEkkGAfOQJYNb-9UOo84V8nj_lKHr_TGDVdFwY2UU0,816
|
4
|
-
schemathesis/_hypothesis.py,sha256=
|
4
|
+
schemathesis/_hypothesis.py,sha256=d9MgjqKSQ_chQ8a8dCBnSQTAboOt2h3914IAmIZTXUI,24660
|
5
5
|
schemathesis/_lazy_import.py,sha256=aMhWYgbU2JOltyWBb32vnWBb6kykOghucEzI_F70yVE,470
|
6
6
|
schemathesis/_override.py,sha256=TAjYB3eJQmlw9K_xiR9ptt9Wj7if4U7UFlUhGjpBAoM,1625
|
7
7
|
schemathesis/_patches.py,sha256=Hsbpn4UVeXUQD2Kllrbq01CSWsTYENWa0VJTyhX5C2k,895
|
@@ -12,13 +12,13 @@ schemathesis/checks.py,sha256=YPUI1N5giGBy1072vd77e6HWelGAKrJUmJLEG4oqfF8,2630
|
|
12
12
|
schemathesis/code_samples.py,sha256=rsdTo6ksyUs3ZMhqx0mmmkPSKUCFa--snIOYsXgZd80,4120
|
13
13
|
schemathesis/constants.py,sha256=l1YQ7PXhEj9dyf9CTESVUpPOaFCH7iz-Fe8o4v6Th_s,2673
|
14
14
|
schemathesis/exceptions.py,sha256=5zjPlyVoQNJGbwufplL6ZVV7FEBPBNPHGdlQRJ7xnhE,20449
|
15
|
-
schemathesis/failures.py,sha256=
|
15
|
+
schemathesis/failures.py,sha256=mrDu7F-OrQY8pRMNVtIxTjovhfyIkcXYjnSkRw-OMuQ,8016
|
16
16
|
schemathesis/filters.py,sha256=f3c_yXIBwIin-9Y0qU2TkcC1NEM_Mw34jGUHQc0BOyw,17026
|
17
17
|
schemathesis/graphql.py,sha256=XiuKcfoOB92iLFC8zpz2msLkM0_V0TLdxPNBqrrGZ8w,216
|
18
18
|
schemathesis/hooks.py,sha256=p5AXgjVGtka0jn9MOeyBaRUtNbqZTs4iaJqytYTacHc,14856
|
19
19
|
schemathesis/lazy.py,sha256=Ddhkk7Tpc_VcRGYkCtKDmP2gpjxVmEZ3b01ZTNjbm8I,19004
|
20
20
|
schemathesis/loaders.py,sha256=MoEhcdOEBJxNRn5X-ZNhWB9jZDHQQNpkNfEdQjf_NDw,4590
|
21
|
-
schemathesis/models.py,sha256=
|
21
|
+
schemathesis/models.py,sha256=8V3ZDTq2l45iFB-kE_NWb64iTy-hkf-hXCI-bIp4oxw,50010
|
22
22
|
schemathesis/parameters.py,sha256=izlu4MFYT1RWrC4RBxrV6weeCal-ODbdLQLMb0PYCZY,2327
|
23
23
|
schemathesis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
schemathesis/sanitization.py,sha256=Lycn1VVfula9B6XpzkxTHja7CZ7RHqbUh9kBic0Yi4M,9056
|
@@ -41,7 +41,7 @@ schemathesis/cli/options.py,sha256=yL7nrzKkbGCc4nQya9wpTW48XGz_OT9hOFrzPxRrDe4,2
|
|
41
41
|
schemathesis/cli/reporting.py,sha256=KC3sxSc1u4aFQ-0Q8CQ3G4HTEl7QxlubGnJgNKmVJdQ,3627
|
42
42
|
schemathesis/cli/sanitization.py,sha256=Onw_NWZSom6XTVNJ5NHnC0PAhrYAcGzIXJbsBCzLkn4,1005
|
43
43
|
schemathesis/cli/output/__init__.py,sha256=AXaUzQ1nhQ-vXhW4-X-91vE2VQtEcCOrGtQXXNN55iQ,29
|
44
|
-
schemathesis/cli/output/default.py,sha256=
|
44
|
+
schemathesis/cli/output/default.py,sha256=MwpvDp29PHaPdkuqO_HIXkbar0n_vlnbXFKEqlbZTKE,39777
|
45
45
|
schemathesis/cli/output/short.py,sha256=CL6-Apxr5tuZ3BL1vecV1MiRY1wDt21g0wiUwZu6mLM,2607
|
46
46
|
schemathesis/contrib/__init__.py,sha256=FH8NL8NXgSKBFOF8Jy_EB6T4CJEaiM-tmDhz16B2o4k,187
|
47
47
|
schemathesis/contrib/unique_data.py,sha256=cTjJfoNpfLMobUzmGnm3k6kVrZcL34_FMPLlpDDsg4c,1249
|
@@ -61,12 +61,12 @@ schemathesis/fixups/utf8_bom.py,sha256=lWT9RNmJG8i-l5AXIpaCT3qCPUwRgzXPW3eoOjmZE
|
|
61
61
|
schemathesis/generation/__init__.py,sha256=29Zys_tD6kfngaC4zHeC6TOBZQcmo7CWm7KDSYsHStQ,1581
|
62
62
|
schemathesis/generation/_hypothesis.py,sha256=74fzLPHugZgMQXerWYFAMqCAjtAXz5E4gek7Gnkhli4,1756
|
63
63
|
schemathesis/generation/_methods.py,sha256=r8oVlJ71_gXcnEhU-byw2E0R2RswQQFm8U7yGErSqbw,1204
|
64
|
-
schemathesis/generation/coverage.py,sha256=
|
64
|
+
schemathesis/generation/coverage.py,sha256=1CilQSe2DIdMdeWA6RL22so2bZULPRwc0CQBRxcLRFs,39370
|
65
65
|
schemathesis/internal/__init__.py,sha256=93HcdG3LF0BbQKbCteOsFMa1w6nXl8yTmx87QLNJOik,161
|
66
66
|
schemathesis/internal/checks.py,sha256=YBhldvs-oQTrtvTlz3cjaO9Ri2oQeyobFcquO4Y0UJ8,2720
|
67
67
|
schemathesis/internal/copy.py,sha256=DcL56z-d69kKR_5u8mlHvjSL1UTyUKNMAwexrwHFY1s,1031
|
68
68
|
schemathesis/internal/datetime.py,sha256=zPLBL0XXLNfP-KYel3H2m8pnsxjsA_4d-zTOhJg2EPQ,136
|
69
|
-
schemathesis/internal/deprecation.py,sha256=
|
69
|
+
schemathesis/internal/deprecation.py,sha256=XnzwSegbbdQyoTF1OGW_s9pdjIfN_Uzzdb2rfah1w2o,1261
|
70
70
|
schemathesis/internal/diff.py,sha256=upGqM6s9WDT653wzxK_tqclFCxqkzB0j4wsO1foq5_k,466
|
71
71
|
schemathesis/internal/extensions.py,sha256=h0aHRK_PTKfiAufkeBziegQS8537TL-Gr1hPW48q8Yc,790
|
72
72
|
schemathesis/internal/jsonschema.py,sha256=-7tF15cXo1ZdhiRFYYfEClXihX2Svc5Loi_Dz1x201k,1157
|
@@ -107,17 +107,17 @@ schemathesis/specs/graphql/validation.py,sha256=uINIOt-2E7ZuQV2CxKzwez-7L9tDtqzM
|
|
107
107
|
schemathesis/specs/openapi/__init__.py,sha256=HDcx3bqpa6qWPpyMrxAbM3uTo0Lqpg-BUNZhDJSJKnw,279
|
108
108
|
schemathesis/specs/openapi/_cache.py,sha256=PAiAu4X_a2PQgD2lG5H3iisXdyg4SaHpU46bRZvfNkM,4320
|
109
109
|
schemathesis/specs/openapi/_hypothesis.py,sha256=nU8UDn1PzGCre4IVmwIuO9-CZv1KJe1fYY0d2BojhSo,22981
|
110
|
-
schemathesis/specs/openapi/checks.py,sha256=
|
110
|
+
schemathesis/specs/openapi/checks.py,sha256=NzUoZ0gZMjyC12KfV7J-5ww8IMaaaNiKum4y7bmA_EA,26816
|
111
111
|
schemathesis/specs/openapi/constants.py,sha256=JqM_FHOenqS_MuUE9sxVQ8Hnw0DNM8cnKDwCwPLhID4,783
|
112
112
|
schemathesis/specs/openapi/converter.py,sha256=Yxw9lS_JKEyi-oJuACT07fm04bqQDlAu-iHwzkeDvE4,3546
|
113
113
|
schemathesis/specs/openapi/definitions.py,sha256=WTkWwCgTc3OMxfKsqh6YDoGfZMTThSYrHGp8h0vLAK0,93935
|
114
114
|
schemathesis/specs/openapi/examples.py,sha256=hdeq7et8AexYGY2iU6SfMZWJ7G0PbOfapUtc4upNs_4,20483
|
115
115
|
schemathesis/specs/openapi/formats.py,sha256=3KtEC-8nQRwMErS-WpMadXsr8R0O-NzYwFisZqMuc-8,2761
|
116
116
|
schemathesis/specs/openapi/links.py,sha256=C4Uir2P_EcpqME8ee_a1vdUM8Tm3ZcKNn2YsGjZiMUQ,17935
|
117
|
-
schemathesis/specs/openapi/loaders.py,sha256=
|
117
|
+
schemathesis/specs/openapi/loaders.py,sha256=jlTYLoG5sVRh8xycIF2M2VDCZ44M80Sct07a_ycg1Po,25698
|
118
118
|
schemathesis/specs/openapi/media_types.py,sha256=dNTxpRQbY3SubdVjh4Cjb38R6Bc9MF9BsRQwPD87x0g,1017
|
119
|
-
schemathesis/specs/openapi/parameters.py,sha256=
|
120
|
-
schemathesis/specs/openapi/patterns.py,sha256=
|
119
|
+
schemathesis/specs/openapi/parameters.py,sha256=X_3PKqUScIiN_vbSFEauPYyxASyFv-_9lZ_9QEZRLqo,14655
|
120
|
+
schemathesis/specs/openapi/patterns.py,sha256=OxZp31cBEHv8fwoeYJ9JcdWNHFMIGzRISNN3dCBc9Dg,11260
|
121
121
|
schemathesis/specs/openapi/references.py,sha256=euxM02kQGMHh4Ss1jWjOY_gyw_HazafKITIsvOEiAvI,9831
|
122
122
|
schemathesis/specs/openapi/schemas.py,sha256=JA9SiBnwYg75kYnd4_0CWOuQv_XTfYwuDeGmFe4RtVo,53724
|
123
123
|
schemathesis/specs/openapi/security.py,sha256=Z-6pk2Ga1PTUtBe298KunjVHsNh5A-teegeso7zcPIE,7138
|
@@ -144,7 +144,7 @@ schemathesis/stateful/context.py,sha256=lpCOVhJEbPOp8F_Z_YvU5ptVTgaKJsllvI1NK28D
|
|
144
144
|
schemathesis/stateful/events.py,sha256=CyYvyQebOaeTn6UevaB7HXOrUhxCWbqXMfQ7pZK7fV8,6727
|
145
145
|
schemathesis/stateful/runner.py,sha256=3tRRmWcXp5GCeRWGOtQ9-W0rxljoR06qSCKC4r7EQyY,12672
|
146
146
|
schemathesis/stateful/sink.py,sha256=bHYlgh-fMwg1Srxk_XGs0-WV34YccotwH9PGrxCK57A,2474
|
147
|
-
schemathesis/stateful/state_machine.py,sha256=
|
147
|
+
schemathesis/stateful/state_machine.py,sha256=EE1T0L21vBU0UHGiCmfPfIfnhU1WptB16h0t1iNVro0,13037
|
148
148
|
schemathesis/stateful/statistic.py,sha256=2-uU5xpT9CbMulKgJWLZN6MUpC0Fskf5yXTt4ef4NFA,542
|
149
149
|
schemathesis/stateful/validation.py,sha256=23qSZjC1_xRmtCX4OqsyG6pGxdlo6IZYid695ZpDQyU,3747
|
150
150
|
schemathesis/transports/__init__.py,sha256=k35qBp-657qnHE9FfCowqO3rqOgCwSUnrdl2vAV3hnQ,12951
|
@@ -153,8 +153,8 @@ schemathesis/transports/auth.py,sha256=urSTO9zgFO1qU69xvnKHPFQV0SlJL3d7_Ojl0tLnZ
|
|
153
153
|
schemathesis/transports/content_types.py,sha256=MiKOm-Hy5i75hrROPdpiBZPOTDzOwlCdnthJD12AJzI,2187
|
154
154
|
schemathesis/transports/headers.py,sha256=hr_AIDOfUxsJxpHfemIZ_uNG3_vzS_ZeMEKmZjbYiBE,990
|
155
155
|
schemathesis/transports/responses.py,sha256=OFD4ZLqwEFpo7F9vaP_SVgjhxAqatxIj38FS4XVq8Qs,1680
|
156
|
-
schemathesis-3.39.
|
157
|
-
schemathesis-3.39.
|
158
|
-
schemathesis-3.39.
|
159
|
-
schemathesis-3.39.
|
160
|
-
schemathesis-3.39.
|
156
|
+
schemathesis-3.39.9.dist-info/METADATA,sha256=RnHYXJblK6aXZcNFawqkoBBO4GoIc-QTmbNVSGIlR0w,11976
|
157
|
+
schemathesis-3.39.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
158
|
+
schemathesis-3.39.9.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
|
159
|
+
schemathesis-3.39.9.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
|
160
|
+
schemathesis-3.39.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|