-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Reduce the number of lines in each test by setting hypothesis settings by defining callable functions in helpers.py - Simplify generation of valid characters by adding strategy for generating valid characters
- Loading branch information
Showing
7 changed files
with
78 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
from datetime import timedelta | ||
from typing import Callable, TypeVar | ||
|
||
from hypothesis import HealthCheck, settings | ||
|
||
_T = TypeVar("_T") | ||
|
||
|
||
def allow_function_scoped(callable: _T, /) -> _T: | ||
"""Allow function_scoped fixtures in tests""" | ||
return settings( | ||
suppress_health_check=[HealthCheck.function_scoped_fixture] | ||
)(callable) | ||
|
||
|
||
def deadline(time: int | float | timedelta | None) -> Callable[[_T], _T]: | ||
"""Change hypothesis deadline""" | ||
|
||
def inner(callable: _T, /) -> _T: | ||
return settings(deadline=time)(callable) | ||
|
||
return inner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.