From 4be13a85d1923f2665f976a50df84e992887e7c9 Mon Sep 17 00:00:00 2001 From: c4ffein Date: Fri, 23 Aug 2024 03:02:33 +0200 Subject: [PATCH] Just skipping actually --- tests/test_pagination.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 7db73dc6..cb304ddf 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -427,15 +427,16 @@ def test_config_error_NOT_SET(): def invalid2(request): pass - +@pytest.mark.skipif(sys.version_info < (3, 11), "Not needed at this Python version") def test_pagination_works_with_unnamed_classes(): """ This test lets you check that the typing.Any case handled in `ninja.pagination.make_response_paginated` - works for Python<3.10, as a typing.Any does possess the __name__ atribute past that version + works for Python>=3.11, as a typing.Any does possess the __name__ atribute past that version """ + PydanticSchemaGenerationError if else TypeError operation = Operation("/whatever", ["GET"], lambda: None, response=List[int]) operation.response_models[200].__annotations__["response"] = List[object()] with pytest.raises( - PydanticSchemaGenerationError if sys.version_info >= (3, 11) else TypeError - ): # It does fail after we passed the logic that we are testing on >=3.11, otherwise from another error + PydanticSchemaGenerationError + ): # It does fail after we passed the logic that we are testing make_response_paginated(LimitOffsetPagination, operation)