schemathesis 3.38.3__py3-none-any.whl → 3.38.4__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 +29 -0
- {schemathesis-3.38.3.dist-info → schemathesis-3.38.4.dist-info}/METADATA +1 -1
- {schemathesis-3.38.3.dist-info → schemathesis-3.38.4.dist-info}/RECORD +6 -6
- {schemathesis-3.38.3.dist-info → schemathesis-3.38.4.dist-info}/WHEEL +0 -0
- {schemathesis-3.38.3.dist-info → schemathesis-3.38.4.dist-info}/entry_points.txt +0 -0
- {schemathesis-3.38.3.dist-info → schemathesis-3.38.4.dist-info}/licenses/LICENSE +0 -0
schemathesis/_hypothesis.py
CHANGED
|
@@ -23,6 +23,7 @@ from .experimental import COVERAGE_PHASE
|
|
|
23
23
|
from .generation import DataGenerationMethod, GenerationConfig, combine_strategies, coverage, get_single_example
|
|
24
24
|
from .hooks import GLOBAL_HOOK_DISPATCHER, HookContext, HookDispatcher
|
|
25
25
|
from .models import APIOperation, Case, GenerationMetadata, TestPhase
|
|
26
|
+
from .parameters import ParameterSet
|
|
26
27
|
from .transports.content_types import parse_content_type
|
|
27
28
|
from .transports.headers import has_invalid_characters, is_latin_1_encodable
|
|
28
29
|
from .types import NotSet
|
|
@@ -356,16 +357,44 @@ def _iter_coverage_cases(
|
|
|
356
357
|
)
|
|
357
358
|
return case
|
|
358
359
|
|
|
360
|
+
def _combination_schema(
|
|
361
|
+
combination: dict[str, Any], _required: set[str], _parameter_set: ParameterSet
|
|
362
|
+
) -> dict[str, Any]:
|
|
363
|
+
return {
|
|
364
|
+
"properties": {
|
|
365
|
+
parameter.name: parameter.as_json_schema(operation)
|
|
366
|
+
for parameter in _parameter_set
|
|
367
|
+
if parameter.name in combination
|
|
368
|
+
},
|
|
369
|
+
"required": list(_required),
|
|
370
|
+
"additionalProperties": False,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
def _yield_negative(
|
|
374
|
+
subschema: dict[str, Any], _location: str, _container_name: str
|
|
375
|
+
) -> Generator[Case, None, None]:
|
|
376
|
+
for more in coverage.cover_schema_iter(
|
|
377
|
+
coverage.CoverageContext(data_generation_methods=[DataGenerationMethod.negative]),
|
|
378
|
+
subschema,
|
|
379
|
+
):
|
|
380
|
+
yield make_case(more.value, more.description, _location, _container_name)
|
|
381
|
+
|
|
359
382
|
# 1. Generate only required properties
|
|
360
383
|
if required and all_params != required:
|
|
361
384
|
only_required = {k: v for k, v in base_container.items() if k in required}
|
|
362
385
|
yield make_case(only_required, "Only required properties", location, container_name)
|
|
386
|
+
if DataGenerationMethod.negative in data_generation_methods:
|
|
387
|
+
subschema = _combination_schema(only_required, required, parameter_set)
|
|
388
|
+
yield from _yield_negative(subschema, location, container_name)
|
|
363
389
|
|
|
364
390
|
# 2. Generate combinations with required properties and one optional property
|
|
365
391
|
for opt_param in optional:
|
|
366
392
|
combo = {k: v for k, v in base_container.items() if k in required or k == opt_param}
|
|
367
393
|
if combo != base_container:
|
|
368
394
|
yield make_case(combo, f"All required properties and optional '{opt_param}'", location, container_name)
|
|
395
|
+
if DataGenerationMethod.negative in data_generation_methods:
|
|
396
|
+
subschema = _combination_schema(combo, required, parameter_set)
|
|
397
|
+
yield from _yield_negative(subschema, location, container_name)
|
|
369
398
|
|
|
370
399
|
# 3. Generate one combination for each size from 2 to N-1 of optional parameters
|
|
371
400
|
if len(optional) > 1:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: schemathesis
|
|
3
|
-
Version: 3.38.
|
|
3
|
+
Version: 3.38.4
|
|
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=lm0J9uQFENfm7-6_wEaNKshGF1wmZebfZJ9G_sUhlqE,20839
|
|
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
|
|
@@ -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.38.
|
|
157
|
-
schemathesis-3.38.
|
|
158
|
-
schemathesis-3.38.
|
|
159
|
-
schemathesis-3.38.
|
|
160
|
-
schemathesis-3.38.
|
|
156
|
+
schemathesis-3.38.4.dist-info/METADATA,sha256=hXln3HxI_xM3plasHcuEeu6OkknqAZgZBAZr-LJZxE0,12956
|
|
157
|
+
schemathesis-3.38.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
158
|
+
schemathesis-3.38.4.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
|
|
159
|
+
schemathesis-3.38.4.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
|
|
160
|
+
schemathesis-3.38.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|