diff --git a/rest_framework-stubs/fields.pyi b/rest_framework-stubs/fields.pyi index 1da8f37ff..7d1b2ffcd 100644 --- a/rest_framework-stubs/fields.pyi +++ b/rest_framework-stubs/fields.pyi @@ -1,21 +1,20 @@ import datetime import uuid from collections import OrderedDict +from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, Sequence from decimal import Decimal from enum import Enum from json import JSONDecoder, JSONEncoder -from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, Sequence from re import Pattern from typing import Any, Generic, NoReturn, Protocol, TypeVar -from _typeshed import Self +from _typeshed import Self from django.core.files.base import File from django.db import models from django.forms import ImageField as DjangoImageField # noqa: F401 -from typing_extensions import Final, TypeAlias - from rest_framework.serializers import BaseSerializer from rest_framework.validators import Validator +from typing_extensions import Final, TypeAlias class _Empty(Enum): sentinel = 0 # noqa: Y015 @@ -340,6 +339,7 @@ class DecimalField(Field[Decimal, int | float | str | Decimal, str, Any]): min_value: Decimal | int | float = ..., localize: bool = ..., rounding: str | None = ..., + normalize_output: bool = ..., *, read_only: bool = ..., write_only: bool = ..., diff --git a/tests/typecheck/test_fields.yml b/tests/typecheck/test_fields.yml index 7447e036c..3f542a3a2 100644 --- a/tests/typecheck/test_fields.yml +++ b/tests/typecheck/test_fields.yml @@ -12,8 +12,8 @@ from django.db import models from rest_framework.fields import DecimalField, IPAddressField, SlugField, RegexField, ModelField, SerializerMethodField, ChoiceField - DecimalField(1, 1, False, 1, 1, False, None) - DecimalField(1, 1, False, 1, 1, False, None, True) # E: Too many positional arguments for "DecimalField" + DecimalField(1, 1, False, 1, 1, False, None, True) + DecimalField(1, 1, False, 1, 1, False, None, True, True) # E: Too many positional arguments for "DecimalField" IPAddressField('both') IPAddressField('both', True) # E: Too many positional arguments for "IPAddressField"