Browse Source

Simplify test description

pull/6039/head
Yurii Motov 1 month ago
parent
commit
d3156706d0
  1. 9
      tests/test_get_model_definitions_formfeed_escape.py

9
tests/test_get_model_definitions_formfeed_escape.py

@ -164,12 +164,9 @@ class SortedTypeSet(Set[Type[Any]]):
@pytest.mark.parametrize("sort_reversed", [True, False]) @pytest.mark.parametrize("sort_reversed", [True, False])
def test_model_description_escaped_with_formfeed(sort_reversed: bool): def test_model_description_escaped_with_formfeed(sort_reversed: bool):
""" """
Ensure that openapi model descriptions that originate from Pydantic docstrings always truncate the docstring to text Regression test for bug fixed by https://github.com/fastapi/fastapi/pull/6039.
that falls before the formfeed (\f) character. This feature was introduced in (https://github.com/tiangolo/fastapi/pull/3032).
When originally introduced, there was a possibility that the truncation may be ignored depending on the order in which Test `get_model_definitions` with models passed in different order.
the models got processed. This created non-deterministic errors, since Pydantic model processing uses unordered sets
and model ordering may differ from one invocation to the next.
This test verifies that (\f) escape of docstrings works in all possible orderings of our two Pydantic model classes.
""" """
all_fields = fastapi.openapi.utils.get_fields_from_routes(app.routes) all_fields = fastapi.openapi.utils.get_fields_from_routes(app.routes)

Loading…
Cancel
Save