Skip to content

Commit

Permalink
Just skipping actually
Browse files Browse the repository at this point in the history
  • Loading branch information
c4ffein committed Aug 23, 2024
1 parent f7cd867 commit 4be13a8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 4be13a8

Please sign in to comment.