diff --git a/django-stubs/db/models/lookups.pyi b/django-stubs/db/models/lookups.pyi index d7462f4d9..3b667fdd5 100644 --- a/django-stubs/db/models/lookups.pyi +++ b/django-stubs/db/models/lookups.pyi @@ -1,6 +1,7 @@ from collections.abc import Iterable, Mapping from typing import Any, Generic, Literal, TypeVar +from django.core.exceptions import EmptyResultSet from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models.expressions import Expression, Func from django.db.models.fields import BooleanField @@ -82,12 +83,20 @@ class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... +class IntegerFieldOverflow: + underflow_exception: type[EmptyResultSet] + overflow_exception: type[EmptyResultSet] + def process_rhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + class IntegerFieldFloatRounding: rhs: Any def get_prep_lookup(self) -> Any: ... -class IntegerGreaterThanOrEqual(IntegerFieldFloatRounding, GreaterThanOrEqual[int | float]): ... -class IntegerLessThan(IntegerFieldFloatRounding, LessThan[int | float]): ... +class IntegerFieldExact(IntegerFieldOverflow, Exact[int | float]): ... +class IntegerGreaterThan(IntegerFieldOverflow, GreaterThan[int | float]): ... +class IntegerGreaterThanOrEqual(IntegerFieldOverflow, IntegerFieldFloatRounding, GreaterThanOrEqual[int | float]): ... +class IntegerLessThan(IntegerFieldOverflow, IntegerFieldFloatRounding, LessThan[int | float]): ... +class IntegerLessThanOrEqual(IntegerFieldOverflow, LessThanOrEqual[int | float]): ... class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup): def split_parameter_list_as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> Any: ... diff --git a/scripts/stubtest/allowlist_todo_django50.txt b/scripts/stubtest/allowlist_todo_django50.txt index e1d9d6ed0..8be179b86 100644 --- a/scripts/stubtest/allowlist_todo_django50.txt +++ b/scripts/stubtest/allowlist_todo_django50.txt @@ -124,12 +124,6 @@ django.db.models.functions.Collate.allowed_default django.db.models.functions.Now.as_oracle django.db.models.functions.comparison.Collate.allowed_default django.db.models.functions.datetime.Now.as_oracle -django.db.models.lookups.IntegerFieldExact -django.db.models.lookups.IntegerFieldOverflow -django.db.models.lookups.IntegerGreaterThan -django.db.models.lookups.IntegerGreaterThanOrEqual.underflow_exception -django.db.models.lookups.IntegerLessThan.overflow_exception -django.db.models.lookups.IntegerLessThanOrEqual django.db.models.lookups.Lookup.allowed_default django.db.models.query.Prefetch.get_current_querysets django.db.models.query_utils.FilteredRelation.relabeled_clone