Skip to content

Commit 642f548

Browse files
authored
Fix given decorator type hint when decorating async functions (#3100)
1 parent 94dd4bd commit 642f548

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ their individual contributions.
5858
* `Gregory Petrosyan <https://github.com/flyingmutant>`_
5959
* `Grigorios Giannakopoulos <https://github.com/grigoriosgiann>`_
6060
* `Hugo van Kemenade <https://github.com/hugovk>`_
61+
* `Humberto Rocha <https://github.com/humrochagf>`_
6162
* `Ilya Lebedev <https://github.com/melevir>`_ ([email protected])
6263
* `Israel Fruchter <https://github.com/fruch>`_
6364
* `Jack Massey <https://github.com/massey101>`_

guides/documentation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ which should:
8888
- finish with a note of thanks from the maintainers:
8989
"Thanks to <your name> for this bug fix / feature / contribution"
9090
(depending on which it is). If this is your first contribution,
91-
don't forget to add yourself to contributors.rst!
91+
don't forget to add yourself to AUTHORS.rst!

hypothesis-python/RELEASE.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RELEASE_TYPE: patch
2+
3+
This release fixes the type hint for the
4+
:func:`@given() <hypothesis.given>` decorator
5+
when decorating an ``async`` function (:issue:`3099`).

hypothesis-python/src/hypothesis/core.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@
3030
from collections import defaultdict
3131
from io import StringIO
3232
from random import Random
33-
from typing import Any, BinaryIO, Callable, Hashable, List, Optional, TypeVar, Union
33+
from typing import (
34+
Any,
35+
BinaryIO,
36+
Callable,
37+
Coroutine,
38+
Hashable,
39+
List,
40+
Optional,
41+
TypeVar,
42+
Union,
43+
)
3444
from unittest import TestCase
3545

3646
import attr
@@ -941,7 +951,9 @@ def fuzz_one_input(
941951
def given(
942952
*_given_arguments: Union[SearchStrategy, InferType],
943953
**_given_kwargs: Union[SearchStrategy, InferType],
944-
) -> Callable[[Callable[..., None]], Callable[..., None]]:
954+
) -> Callable[
955+
[Callable[..., Union[None, Coroutine[Any, Any, None]]]], Callable[..., None]
956+
]:
945957
"""A decorator for turning a test function that accepts arguments into a
946958
randomized test.
947959

0 commit comments

Comments
 (0)