diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index 5b0195714..2bf305d99 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -53,6 +53,15 @@ class TestFieldMapping(TestCase): with self.subTest(field=field): assert inspector._map_field(field) == mapping + def test_lazy_string_field(self): + class Serializer(serializers.Serializer): + text = serializers.CharField(help_text=_('lazy string')) + + inspector = AutoSchema() + + data = inspector._map_serializer(Serializer()) + assert isinstance(data['properties']['text']['description'], str), "description must be str" + @pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.') class TestOperationIntrospection(TestCase): @@ -274,15 +283,6 @@ class TestOperationIntrospection(TestCase): assert response_schema['ip']['type'] == 'string' assert 'format' not in response_schema['ip'] - def test_lazy_string_field(self): - class Serializer(serializers.Serializer): - text = serializers.CharField(help_text=_('lazy string')) - - inspector = AutoSchema() - - data = inspector._map_serializer(Serializer()) - assert isinstance(data['properties']['text']['description'], str), "description must be str" - @pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.') @override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.openapi.AutoSchema'})