Skip to content

Commit

Permalink
chore: Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Jun 15, 2020
1 parent 40818f9 commit 3cb0a7b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/schemathesis/_hypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,14 @@ def get_case_strategy(endpoint: Endpoint, hooks: Optional[HookDispatcher] = None
"""
strategies = {}
static_kwargs: Dict[str, Any] = {"endpoint": endpoint}
try:
for parameter in PARAMETERS:
value = getattr(endpoint, parameter)
if value is not None:
location = {"headers": "header", "cookies": "cookie", "path_parameters": "path"}.get(
parameter, parameter
)
strategies[parameter] = prepare_strategy(
parameter, value, endpoint.get_hypothesis_conversions(location)
)
else:
static_kwargs[parameter] = None
return _get_case_strategy(endpoint, static_kwargs, strategies, hooks)
except AssertionError:
raise InvalidSchema("Invalid schema for this endpoint")
for parameter in PARAMETERS:
value = getattr(endpoint, parameter)
if value is not None:
location = {"headers": "header", "cookies": "cookie", "path_parameters": "path"}.get(parameter, parameter)
strategies[parameter] = prepare_strategy(parameter, value, endpoint.get_hypothesis_conversions(location))
else:
static_kwargs[parameter] = None
return _get_case_strategy(endpoint, static_kwargs, strategies, hooks)


def prepare_strategy(parameter: str, value: Dict[str, Any], map_func: Optional[Callable]) -> st.SearchStrategy:
Expand Down

0 comments on commit 3cb0a7b

Please sign in to comment.