File 0001-Quick-and-Dirty-djangorestframework-compatibility-fix.patch of Package python-drf-spectacular
Index: drf_spectacular-0.28.0/tests/test_i18n.py
===================================================================
--- drf_spectacular-0.28.0.orig/tests/test_i18n.py
+++ drf_spectacular-0.28.0/tests/test_i18n.py
@@ -4,6 +4,7 @@ import pytest
import yaml
from django.db import models
from django.urls import include, path
+from django.utils.translation import gettext
from django.utils import translation
from django.utils.translation import gettext_lazy as _
from rest_framework import mixins, routers, serializers, viewsets
@@ -66,9 +67,21 @@ urlpatterns = [
)
def test_i18n_strings(no_warnings):
with translation.override('de-de'):
+ id_desciption = gettext('A {value_type} identifying this {name}.').format(
+ value_type=_('unique integer value'),
+ name=I18nModel._meta.verbose_name,
+ )
schema = generate_schema(None, patterns=urlpatterns)
- assert_schema(schema, 'tests/test_i18n.yml')
-
+ assert_schema(
+ schema,
+ 'tests/test_i18n.yml',
+ reverse_transforms=[
+ lambda x: x.replace(
+ '\n description: A unique integer value identifying this root',
+ f'\n description: {id_desciption}'
+ )
+ ]
+ )
@pytest.mark.parametrize(['url', 'header', 'translated'], [
('/api/schema/', {}, False),
Index: drf_spectacular-0.28.0/tests/test_i18n.yml
===================================================================
--- drf_spectacular-0.28.0.orig/tests/test_i18n.yml
+++ drf_spectacular-0.28.0/tests/test_i18n.yml
@@ -106,7 +106,7 @@ paths:
name: id
schema:
type: integer
- description: A unique integer value identifying this Internätiönalisierung.
+ description: A unique integer value identifying this root
required: true
tags:
- x