Skip to content

Commit 6b76c3e

Browse files
Fix type of data parameter in get test requests
Lists of two-tuples of strings are allowed
1 parent e46f90e commit 6b76c3e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rest_framework-stubs/test.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Optional, Type, Union
1+
from typing import Any, Dict, List, Optional, Tuple, Type, Union
22

33
import coreapi
44
import requests
@@ -14,6 +14,8 @@ from rest_framework.authtoken.models import Token
1414
from rest_framework.request import Request
1515
from rest_framework.response import Response
1616

17+
_GetDataType = Optional[Union[Dict[str, Any], str, List[Tuple[str, str]]]]
18+
1719
def force_authenticate(
1820
request: HttpRequest, user: Optional[Union[AnonymousUser, AbstractBaseUser]] = ..., token: Optional[Token] = ...
1921
) -> None: ...
@@ -50,7 +52,7 @@ class APIRequestFactory(DjangoRequestFactory):
5052
renderer_classes: Any = ...
5153
def __init__(self, enforce_csrf_checks: bool = ..., **defaults: Any) -> None: ...
5254
def request(self, **kwargs: Any) -> Request: ... # type: ignore[override]
53-
def get(self, path: str, data: Optional[Union[Dict[str, Any], str]] = ..., follow: bool = ..., **extra: Any): ... # type: ignore[override]
55+
def get(self, path: str, data: _GetDataType = ..., follow: bool = ..., **extra: Any): ... # type: ignore[override]
5456
def post(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Request: ... # type: ignore[override]
5557
def put(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Request: ... # type: ignore[override]
5658
def patch(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Request: ... # type: ignore[override]
@@ -71,7 +73,7 @@ class APIClient(APIRequestFactory, DjangoClient):
7173
self, user: Union[AnonymousUser, AbstractBaseUser] = ..., token: Optional[Token] = ...
7274
) -> None: ...
7375
def request(self, **kwargs: Any) -> Response: ... # type: ignore[override]
74-
def get(self, path: str, data: Optional[Union[Dict[str, Any], str]] = ..., follow: bool = ..., **extra: Any): ... # type: ignore[override]
76+
def get(self, path: str, data: _GetDataType = ..., follow: bool = ..., **extra: Any): ... # type: ignore[override]
7577
def post(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Response: ... # type: ignore[override]
7678
def put(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Response: ... # type: ignore[override]
7779
def patch(self, path: str, data: Optional[Any] = ..., format: Optional[str] = ..., content_type: Optional[str] = ..., follow: bool = ..., **extra: Any) -> Response: ... # type: ignore[override]

0 commit comments

Comments
 (0)