From 3cd8e1038c2e04e52cb6010068fad262ce7a0673 Mon Sep 17 00:00:00 2001 From: SaJH Date: Mon, 15 Apr 2024 13:24:38 +0900 Subject: [PATCH] [3.15] Add DecimalField normalize_output argument (#576) --- rest_framework-stubs/fields.pyi | 2 ++ scripts/stubtest/allowlist_todo.txt | 2 -- tests/typecheck/test_fields.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework-stubs/fields.pyi b/rest_framework-stubs/fields.pyi index 03610e99f..bb56ccb8e 100644 --- a/rest_framework-stubs/fields.pyi +++ b/rest_framework-stubs/fields.pyi @@ -329,6 +329,7 @@ class DecimalField(Field[Decimal, int | float | str | Decimal, str, Any]): min_value: Decimal | int | float | None localize: bool rounding: str | None + normalize_output: bool max_whole_digits: int | None def __init__( self, @@ -339,6 +340,7 @@ class DecimalField(Field[Decimal, int | float | str | Decimal, str, Any]): min_value: Decimal | int | float | None = None, localize: bool = ..., rounding: str | None = None, + normalize_output: bool = ..., *, read_only: bool = ..., write_only: bool = ..., diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index e807c6039..c399d9dd7 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -140,7 +140,6 @@ rest_framework.views.GenericView rest_framework.RemovedInDRF317Warning rest_framework.authtoken.migrations.0004_alter_tokenproxy_options rest_framework.compat.distinct -rest_framework.fields.DecimalField.__init__ rest_framework.fields.Field.__class_getitem__ rest_framework.fields.logger rest_framework.filters.search_smart_split @@ -148,7 +147,6 @@ rest_framework.generics.GenericAPIView.__class_getitem__ rest_framework.request.Request.__class_getitem__ rest_framework.response.Response.__class_getitem__ rest_framework.routers.BaseRouter.is_already_registered -rest_framework.serializers.DecimalField.__init__ rest_framework.serializers.Field.__class_getitem__ rest_framework.serializers.LIST_SERIALIZER_KWARGS_REMOVE rest_framework.serializers.ListSerializer.run_child_validation diff --git a/tests/typecheck/test_fields.yml b/tests/typecheck/test_fields.yml index fae186768..d5aafca30 100644 --- a/tests/typecheck/test_fields.yml +++ b/tests/typecheck/test_fields.yml @@ -13,8 +13,8 @@ from django.db import models from rest_framework.fields import DecimalField, IPAddressField, SlugField, RegexField, ModelField, SerializerMethodField, ChoiceField, DateTimeField, DateField, TimeField - 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, False) + DecimalField(1, 1, False, 1, 1, False, None, False, True) # E: Too many positional arguments for "DecimalField" IPAddressField('both') IPAddressField('both', True) # E: Too many positional arguments for "IPAddressField"