-
-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add django.db.models.query.BaseIterable and subclasses (#1242)
Closes #1237.
- Loading branch information
joshua-jandyco
authored
Nov 11, 2022
1 parent
a0e98a2
commit 1b8c1b5
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
- case: django_db_models_query_module_has_ModelIterable | ||
main: | | ||
from django.db.models.query import ModelIterable | ||
from django.db.models import Model | ||
class IntModelIterable(ModelIterable[int]): | ||
pass | ||
class NoTypeParameterModelIterable(ModelIterable): | ||
pass | ||
class ModelModelIterable(ModelIterable[Model]): | ||
pass | ||
class MyModel(Model): | ||
pass | ||
class MyModelModelIterable(ModelIterable[MyModel]): | ||
pass | ||
out: | | ||
main:4: error: Type argument "int" of "ModelIterable" must be a subtype of "Model" | ||
- case: django_db_models_query_module_has_ValuesListIterable | ||
main: | | ||
from django.db.models.query import ValuesListIterable | ||
class IntValuesListIterable(ValuesListIterable[tuple[int,int]]): | ||
pass | ||
class StringsValuesListIterable(ValuesListIterable[tuple[str,str,str]]): | ||
pass | ||
class MultiTypeValuesListIterable(ValuesListIterable[tuple[str,int,float]]): | ||
pass | ||
class NonTupleValuesListIterable(ValuesListIterable[int]): | ||
pass | ||
out: | | ||
main:10: error: Type argument "int" of "ValuesListIterable" must be a subtype of "Tuple[Any, ...]" | ||
- case: django_db_models_query_module_has_NamedValuesListIterable | ||
main: | | ||
from django.db.models.query import NamedValuesListIterable | ||
out: | | ||
- case: QuerySet_has__iterable_class_defined | ||
main: | | ||
from django.db.models.query import QuerySet, ValuesIterable, ModelIterable | ||
iterable_class = QuerySet._iterable_class | ||
QuerySet._iterable_class = ValuesIterable | ||
QuerySet._iterable_class = ModelIterable | ||
QuerySet._iterable_class = int | ||
out: | | ||
main:5: error: Incompatible types in assignment (expression has type "Type[int]", variable has type "Type[BaseIterable[Any]]") |