Skip to content

Commit

Permalink
Fix tests: revert (test_fieldset_workaround_regression) & update erro…
Browse files Browse the repository at this point in the history
…r message
  • Loading branch information
intgr committed Jun 5, 2023
1 parent a7cb888 commit 9d13593
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions django-stubs/contrib/admin/options.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from typing import Any, Generic, Literal, TypeVar, Union # noqa: Y037 # https://github.com/python/mypy/issues/12211
from typing import ( # noqa: Y037 # https://github.com/python/mypy/issues/12211
Any,
Generic,
Literal,
Optional,
TypeVar,
Union,
)

from django import forms
from django.contrib.admin.filters import FieldListFilter, ListFilter
@@ -81,7 +88,7 @@ class BaseModelAdmin(Generic[_ModelT]):
raw_id_fields: Sequence[str]
fields: _FieldGroups | None
exclude: Sequence[str] | None
fieldsets: _FieldsetSpec | None
fieldsets: Optional[_FieldsetSpec] # noqa: UP007
form: type[forms.ModelForm[_ModelT]]
filter_vertical: Sequence[str]
filter_horizontal: Sequence[str]
2 changes: 1 addition & 1 deletion tests/typecheck/db/migrations/test_operations.yml
Original file line number Diff line number Diff line change
@@ -16,5 +16,5 @@
RunSQL(sql=["SOME SQLS", ("SOME SQLS %s, %s", ["PARAM", "ANOTHER PARAM"])], reverse_sql=["SOME SQLS", ("SOME SQLS %s, %s", ["PARAM", "ANOTHER PARAM"])])
RunSQL(sql=("SOME SQL", {})) # E: Argument "sql" to "RunSQL" has incompatible type "Tuple[str, Dict[<nothing>, <nothing>]]"; expected "Union[str, Union[List[Union[str, Tuple[str, Union[Dict[str, Any], List[str], Tuple[str, ...], Tuple[], None]]]], Tuple[Union[str, Tuple[str, Union[Dict[str, Any], List[str], Tuple[str, ...], Tuple[], None]]], ...], Tuple[]]]"
RunSQL(sql=("SOME SQL", {})) # E: Argument "sql" to "RunSQL" has incompatible type "Tuple[str, Dict[<nothing>, <nothing>]]"; expected "Union[str, Union[List[Union[str, Tuple[str, Union[Dict[str, Any], Union[List[str], Tuple[str, ...], Tuple[]], None]]]], Tuple[Union[str, Tuple[str, Union[Dict[str, Any], Union[List[str], Tuple[str, ...], Tuple[]], None]]], ...], Tuple[]]]"
RunSQL(sql=["SOME SQLS", ("SOME SQLS %s, %s", [object(), "ANOTHER PARAM"])]) # E: List item 0 has incompatible type "object"; expected "str"

0 comments on commit 9d13593

Please sign in to comment.