schemathesis 4.0.19__py3-none-any.whl → 4.0.21__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/generation/hypothesis/__init__.py +0 -3
- schemathesis/generation/hypothesis/builder.py +1 -4
- schemathesis/specs/openapi/checks.py +2 -0
- schemathesis/specs/openapi/patterns.py +60 -5
- {schemathesis-4.0.19.dist-info → schemathesis-4.0.21.dist-info}/METADATA +1 -1
- {schemathesis-4.0.19.dist-info → schemathesis-4.0.21.dist-info}/RECORD +9 -9
- {schemathesis-4.0.19.dist-info → schemathesis-4.0.21.dist-info}/WHEEL +0 -0
- {schemathesis-4.0.19.dist-info → schemathesis-4.0.21.dist-info}/entry_points.txt +0 -0
- {schemathesis-4.0.19.dist-info → schemathesis-4.0.21.dist-info}/licenses/LICENSE +0 -0
@@ -28,7 +28,7 @@ from schemathesis.core.transport import prepare_urlencoded
|
|
28
28
|
from schemathesis.core.validation import has_invalid_characters, is_latin_1_encodable
|
29
29
|
from schemathesis.generation import GenerationMode, coverage
|
30
30
|
from schemathesis.generation.case import Case
|
31
|
-
from schemathesis.generation.hypothesis import
|
31
|
+
from schemathesis.generation.hypothesis import examples, setup, strategies
|
32
32
|
from schemathesis.generation.hypothesis.examples import add_single_example
|
33
33
|
from schemathesis.generation.hypothesis.given import GivenInput
|
34
34
|
from schemathesis.generation.meta import (
|
@@ -124,9 +124,6 @@ def create_test(
|
|
124
124
|
settings = getattr(hypothesis_test, SETTINGS_ATTRIBUTE_NAME, None)
|
125
125
|
assert settings is not None
|
126
126
|
|
127
|
-
if settings.deadline == default.deadline:
|
128
|
-
settings = hypothesis.settings(settings, deadline=DEFAULT_DEADLINE)
|
129
|
-
|
130
127
|
if settings.verbosity == default.verbosity:
|
131
128
|
settings = hypothesis.settings(settings, verbosity=Verbosity.quiet)
|
132
129
|
|
@@ -513,6 +513,8 @@ def ignored_auth(ctx: CheckContext, response: Response, case: Case) -> bool | No
|
|
513
513
|
_remove_auth_from_container(container, security_parameters, location=location)
|
514
514
|
kwargs[container_name] = container
|
515
515
|
kwargs.pop("session", None)
|
516
|
+
if case.operation.app is not None:
|
517
|
+
kwargs.setdefault("app", case.operation.app)
|
516
518
|
ctx._record_case(parent_id=case.id, case=no_auth_case)
|
517
519
|
no_auth_response = case.operation.schema.transport.send(no_auth_case, **kwargs)
|
518
520
|
ctx._record_response(case_id=no_auth_case.id, response=no_auth_response)
|
@@ -174,8 +174,18 @@ def _handle_anchored_pattern(parsed: list, pattern: str, min_length: int | None,
|
|
174
174
|
continue
|
175
175
|
if pattern[current_position] == "\\":
|
176
176
|
# Escaped value
|
177
|
-
current_position += 2
|
178
177
|
result += "\\"
|
178
|
+
# Could be an octal value
|
179
|
+
if (
|
180
|
+
current_position + 2 < len(pattern)
|
181
|
+
and pattern[current_position + 1] == "0"
|
182
|
+
and pattern[current_position + 2] in ("0", "1", "2", "3", "4", "5", "6", "7")
|
183
|
+
):
|
184
|
+
result += pattern[current_position + 1]
|
185
|
+
result += pattern[current_position + 2]
|
186
|
+
current_position += 3
|
187
|
+
continue
|
188
|
+
current_position += 2
|
179
189
|
else:
|
180
190
|
current_position += 1
|
181
191
|
result += chr(value)
|
@@ -349,13 +359,58 @@ def _handle_repeat_quantifier(
|
|
349
359
|
) -> str:
|
350
360
|
"""Handle repeat quantifiers (e.g., '+', '*', '?')."""
|
351
361
|
min_repeat, max_repeat, _ = value
|
352
|
-
|
353
|
-
|
354
|
-
return pattern
|
362
|
+
|
363
|
+
# First, analyze the inner pattern
|
355
364
|
inner = _strip_quantifier(pattern)
|
356
365
|
if inner.startswith("(") and inner.endswith(")"):
|
357
366
|
inner = inner[1:-1]
|
358
|
-
|
367
|
+
|
368
|
+
# Determine the length of the inner pattern
|
369
|
+
inner_length = 1 # default assumption for non-literal patterns
|
370
|
+
try:
|
371
|
+
parsed = sre_parse.parse(inner)
|
372
|
+
if all(item[0] == LITERAL for item in parsed):
|
373
|
+
inner_length = len(parsed)
|
374
|
+
if max_length and max_length > 0 and inner_length > max_length:
|
375
|
+
return pattern
|
376
|
+
except re.error:
|
377
|
+
pass
|
378
|
+
|
379
|
+
if inner_length == 0:
|
380
|
+
# Empty pattern contributes 0 chars regardless of repetitions
|
381
|
+
# For length constraints, only 0 repetitions make sense
|
382
|
+
if min_length is not None and min_length > 0:
|
383
|
+
return pattern # Can't satisfy positive length with empty pattern
|
384
|
+
return f"({inner})" + _build_quantifier(0, 0)
|
385
|
+
|
386
|
+
# Convert external length constraints to repetition constraints
|
387
|
+
external_min_repeat = None
|
388
|
+
external_max_repeat = None
|
389
|
+
|
390
|
+
if min_length is not None:
|
391
|
+
# Need at least ceil(min_length / inner_length) repetitions
|
392
|
+
external_min_repeat = (min_length + inner_length - 1) // inner_length
|
393
|
+
|
394
|
+
if max_length is not None:
|
395
|
+
# Can have at most floor(max_length / inner_length) repetitions
|
396
|
+
external_max_repeat = max_length // inner_length
|
397
|
+
|
398
|
+
# Merge original repetition constraints with external constraints
|
399
|
+
final_min_repeat = min_repeat
|
400
|
+
if external_min_repeat is not None:
|
401
|
+
final_min_repeat = max(min_repeat, external_min_repeat)
|
402
|
+
|
403
|
+
final_max_repeat = max_repeat
|
404
|
+
if external_max_repeat is not None:
|
405
|
+
if max_repeat == MAXREPEAT:
|
406
|
+
final_max_repeat = external_max_repeat
|
407
|
+
else:
|
408
|
+
final_max_repeat = min(max_repeat, external_max_repeat)
|
409
|
+
|
410
|
+
if final_min_repeat > final_max_repeat:
|
411
|
+
return pattern
|
412
|
+
|
413
|
+
return f"({inner})" + _build_quantifier(final_min_repeat, final_max_repeat)
|
359
414
|
|
360
415
|
|
361
416
|
def _handle_literal_or_in_quantifier(pattern: str, min_length: int | None, max_length: int | None) -> str:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: schemathesis
|
3
|
-
Version: 4.0.
|
3
|
+
Version: 4.0.21
|
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://github.com/schemathesis/schemathesis/blob/master/CHANGELOG.md
|
@@ -90,8 +90,8 @@ schemathesis/generation/meta.py,sha256=adkoMuCfzSjHJ9ZDocQn0GnVldSCkLL3eVR5A_jaf
|
|
90
90
|
schemathesis/generation/metrics.py,sha256=cZU5HdeAMcLFEDnTbNE56NuNq4P0N4ew-g1NEz5-kt4,2836
|
91
91
|
schemathesis/generation/modes.py,sha256=Q1fhjWr3zxabU5qdtLvKfpMFZJAwlW9pnxgenjeXTyU,481
|
92
92
|
schemathesis/generation/overrides.py,sha256=OBWqDQPreiliaf2M-oyXppVKHoJkCRzxtwSJx1b6AFw,3759
|
93
|
-
schemathesis/generation/hypothesis/__init__.py,sha256=
|
94
|
-
schemathesis/generation/hypothesis/builder.py,sha256=
|
93
|
+
schemathesis/generation/hypothesis/__init__.py,sha256=76QYchbfeA-A_G_bP6_BkG5JO9SxIIP1yNRBZa06RvE,1495
|
94
|
+
schemathesis/generation/hypothesis/builder.py,sha256=f_5VsqeHKP-07pJZ0CPpW6YSxs9qUEseanAaxwOwdm4,34970
|
95
95
|
schemathesis/generation/hypothesis/examples.py,sha256=6eGaKUEC3elmKsaqfKj1sLvM8EHc-PWT4NRBq4NI0Rs,1409
|
96
96
|
schemathesis/generation/hypothesis/given.py,sha256=sTZR1of6XaHAPWtHx2_WLlZ50M8D5Rjux0GmWkWjDq4,2337
|
97
97
|
schemathesis/generation/hypothesis/reporting.py,sha256=uDVow6Ya8YFkqQuOqRsjbzsbyP4KKfr3jA7ZaY4FuKY,279
|
@@ -124,7 +124,7 @@ schemathesis/specs/graphql/validation.py,sha256=-W1Noc1MQmTb4RX-gNXMeU2qkgso4mzV
|
|
124
124
|
schemathesis/specs/openapi/__init__.py,sha256=C5HOsfuDJGq_3mv8CRBvRvb0Diy1p0BFdqyEXMS-loE,238
|
125
125
|
schemathesis/specs/openapi/_cache.py,sha256=HpglmETmZU0RCHxp3DO_sg5_B_nzi54Zuw9vGzzYCxY,4295
|
126
126
|
schemathesis/specs/openapi/_hypothesis.py,sha256=H-4pzT7dECY-AcDGhebKdTSELhGOdyA1WCbZQSMZY3E,22309
|
127
|
-
schemathesis/specs/openapi/checks.py,sha256=
|
127
|
+
schemathesis/specs/openapi/checks.py,sha256=t3ZIyzRPd_KnJzdp57Y_9CZLYC98NAqsE3dgNfuCOBA,29971
|
128
128
|
schemathesis/specs/openapi/constants.py,sha256=JqM_FHOenqS_MuUE9sxVQ8Hnw0DNM8cnKDwCwPLhID4,783
|
129
129
|
schemathesis/specs/openapi/converter.py,sha256=LkpCCAxZzET4Qa_3YStSNuhGlsm5G6TVwpxYu6lPO4g,4169
|
130
130
|
schemathesis/specs/openapi/definitions.py,sha256=8htclglV3fW6JPBqs59lgM4LnA25Mm9IptXBPb_qUT0,93949
|
@@ -132,7 +132,7 @@ schemathesis/specs/openapi/examples.py,sha256=V1fbsbMto_So7lTWnyGa7f3u9On2br8yZ-
|
|
132
132
|
schemathesis/specs/openapi/formats.py,sha256=8AIS7Uey-Z1wm1WYRqnsVqHwG9d316PdqfKLqwUs7us,3516
|
133
133
|
schemathesis/specs/openapi/media_types.py,sha256=F5M6TKl0s6Z5X8mZpPsWDEdPBvxclKRcUOc41eEwKbo,2472
|
134
134
|
schemathesis/specs/openapi/parameters.py,sha256=ifu_QQCMUzsUHQAkvsOvLuokns6CzesssmQ3Nd3zxII,14594
|
135
|
-
schemathesis/specs/openapi/patterns.py,sha256=
|
135
|
+
schemathesis/specs/openapi/patterns.py,sha256=GqPZEXMRdWENQxanWjBOalIZ2MQUjuxk21kmdiI703E,18027
|
136
136
|
schemathesis/specs/openapi/references.py,sha256=40YcDExPLR2B8EOwt-Csw-5MYFi2xj_DXf91J0Pc9d4,8855
|
137
137
|
schemathesis/specs/openapi/schemas.py,sha256=ZhFYxYzm0u9VpPMD5f_tt15l29OMa4-lrofOWf4Q6yM,52790
|
138
138
|
schemathesis/specs/openapi/security.py,sha256=6UWYMhL-dPtkTineqqBFNKca1i4EuoTduw-EOLeE0aQ,7149
|
@@ -157,8 +157,8 @@ schemathesis/transport/prepare.py,sha256=erYXRaxpQokIDzaIuvt_csHcw72iHfCyNq8VNEz
|
|
157
157
|
schemathesis/transport/requests.py,sha256=46aplzhSmBupegPNMawma-iJWCegWkEd6mzdWLTpgM4,10742
|
158
158
|
schemathesis/transport/serialization.py,sha256=igUXKZ_VJ9gV7P0TUc5PDQBJXl_s0kK9T3ljGWWvo6E,10339
|
159
159
|
schemathesis/transport/wsgi.py,sha256=KoAfvu6RJtzyj24VGB8e-Iaa9smpgXJ3VsM8EgAz2tc,6152
|
160
|
-
schemathesis-4.0.
|
161
|
-
schemathesis-4.0.
|
162
|
-
schemathesis-4.0.
|
163
|
-
schemathesis-4.0.
|
164
|
-
schemathesis-4.0.
|
160
|
+
schemathesis-4.0.21.dist-info/METADATA,sha256=HP1W2NG4U59FCpvqyJKxlh5Gcl-vtEOKJvRYWGaCmuw,8472
|
161
|
+
schemathesis-4.0.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
162
|
+
schemathesis-4.0.21.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
|
163
|
+
schemathesis-4.0.21.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
|
164
|
+
schemathesis-4.0.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|