Skip to content

Commit e494d44

Browse files
authored
Fix types for TestCase.assertJSON{Not,}Equal (#2497)
The implementation of this function just passes the `raw` value to `json.loads`, which [is typed as accepting][1] strings, bytes objects, or bytearrays. Update the signature of `assertJSONEqual` and `assertJSONNotEqual` to match. [1]: https://github.com/python/typeshed/blob/aac4394eb29d86797628b57d6f01f5e17f5ff83f/stdlib/json/__init__.pyi#L40
1 parent 4908e0e commit e494d44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

django-stubs/test/testcases.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ class SimpleTestCase(unittest.TestCase):
152152
def assertInHTML(self, needle: str, haystack: str, count: int | None = ..., msg_prefix: str = ...) -> None: ...
153153
def assertJSONEqual(
154154
self,
155-
raw: str,
155+
raw: str | bytes | bytearray,
156156
expected_data: dict[str, Any] | list[Any] | str | int | float | bool | None,
157157
msg: str | None = ...,
158158
) -> None: ...
159159
def assertJSONNotEqual(
160160
self,
161-
raw: str,
161+
raw: str | bytes | bytearray,
162162
expected_data: dict[str, Any] | list[Any] | str | int | float | bool | None,
163163
msg: str | None = ...,
164164
) -> None: ...

0 commit comments

Comments
 (0)