Skip to content

Commit b3034ab

Browse files
authored
Update django.test.client and django.utils for Django 5.2 (#2599)
Signed-off-by: SaJH <wogur981208@gmail.com>
1 parent f7a0004 commit b3034ab

File tree

7 files changed

+21
-48
lines changed

7 files changed

+21
-48
lines changed

django-stubs/test/client.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class FakePayload(IOBase):
3434
read_started: bool
3535
def __init__(self, initial_bytes: bytes | str | None = ...) -> None: ...
3636
def __len__(self) -> int: ...
37-
def read(self, size: int = ...) -> bytes: ...
37+
def read(self, size: int = ..., /) -> bytes: ...
3838
def readline(self, size: int | None = ..., /) -> bytes: ...
39-
def write(self, content: bytes | str) -> None: ...
39+
def write(self, content: bytes | str, /) -> None: ...
4040

4141
_T = TypeVar("_T")
4242

django-stubs/utils/deprecation.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ from typing import Any, Protocol, TypeAlias, type_check_only
44
from django.http.request import HttpRequest
55
from django.http.response import HttpResponseBase
66

7-
class RemovedInNextVersionWarning(DeprecationWarning): ...
8-
class RemovedInDjango60Warning(PendingDeprecationWarning): ...
7+
class RemovedInDjango60Warning(DeprecationWarning): ...
8+
class RemovedInDjango61Warning(PendingDeprecationWarning): ...
99

10-
RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango60Warning
10+
RemovedInNextVersionWarning: TypeAlias = RemovedInDjango60Warning
11+
RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango61Warning
1112

1213
class warn_about_renamed_method:
1314
class_name: str
@@ -23,11 +24,6 @@ class RenameMethodsBase(type):
2324
renamed_methods: Any
2425
def __new__(cls, name: Any, bases: Any, attrs: Any) -> type: ...
2526

26-
class DeprecationInstanceCheck(type):
27-
alternative: str
28-
deprecation_warning: type[Warning]
29-
def __instancecheck__(self, instance: Any) -> bool: ...
30-
3127
@type_check_only
3228
class _GetResponseCallable(Protocol):
3329
def __call__(self, request: HttpRequest, /) -> HttpResponseBase: ...

django-stubs/utils/feedgenerator.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ def rfc2822_date(date: datetime.date) -> str: ...
88
def rfc3339_date(date: datetime.date) -> str: ...
99
def get_tag_uri(url: str, date: datetime.date | None) -> str: ...
1010

11+
class Stylesheet:
12+
def __init__(
13+
self,
14+
url: str,
15+
mimetype: str = ...,
16+
media: str = ...,
17+
) -> None: ...
18+
@property
19+
def url(self) -> str: ...
20+
@property
21+
def mimetype(self) -> str: ...
22+
1123
class SyndicationFeed:
1224
feed: dict[str, Any]
1325
items: list[dict[str, Any]]
@@ -26,6 +38,7 @@ class SyndicationFeed:
2638
feed_copyright: str | None = ...,
2739
feed_guid: str | None = ...,
2840
ttl: int | None = ...,
41+
stylesheets: list[Stylesheet] | None = ...,
2942
**kwargs: Any,
3043
) -> None: ...
3144
def add_item(
@@ -50,6 +63,7 @@ class SyndicationFeed:
5063
def num_items(self) -> int: ...
5164
def root_attributes(self) -> dict[Any, Any]: ...
5265
def add_root_elements(self, handler: SimplerXMLGenerator) -> None: ...
66+
def add_stylesheets(self, handler: SimplerXMLGenerator) -> None: ...
5367
def item_attributes(self, item: dict[str, Any]) -> dict[Any, Any]: ...
5468
def add_item_elements(
5569
self,

django-stubs/utils/http.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RFC850_DATE: Pattern[str]
88
ASCTIME_DATE: Pattern[str]
99
RFC3986_GENDELIMS: str
1010
RFC3986_SUBDELIMS: str
11+
MAX_URL_LENGTH: int
1112

1213
def urlencode(
1314
query: (

django-stubs/utils/jslex.pyi

Lines changed: 0 additions & 27 deletions
This file was deleted.

scripts/stubtest/allowlist_todo_django52.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,4 @@ django.template.autoreload
275275
django.template.library.Library.simple_block_tag
276276
django.template.library.SimpleBlockNode
277277
django.template.loader_tags.construct_relative_path
278-
django.test.client.FakePayload.read
279-
django.test.client.FakePayload.write
280278
django.test.runner.ParallelTestSuite.handle_event
281-
django.utils.deprecation.DeprecationInstanceCheck
282-
django.utils.deprecation.RemovedInDjango61Warning
283-
django.utils.feedgenerator.RssFeed.add_stylesheets
284-
django.utils.feedgenerator.Stylesheet
285-
django.utils.feedgenerator.SyndicationFeed.__init__
286-
django.utils.feedgenerator.SyndicationFeed.add_stylesheets
287-
django.utils.http.MAX_URL_LENGTH
288-
django.utils.jslex

tests/typecheck/test_import_all.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@
639639
import django.utils.inspect
640640
import django.utils.ipv6
641641
import django.utils.itercompat
642-
import django.utils.jslex
643642
import django.utils.log
644643
import django.utils.lorem_ipsum
645644
import django.utils.module_loading

0 commit comments

Comments
 (0)