diff --git a/ninja/pagination.py b/ninja/pagination.py index c19f7df2..48ad1e21 100644 --- a/ninja/pagination.py +++ b/ninja/pagination.py @@ -282,7 +282,7 @@ class PagedSome: try: new_name = f"Paged{item_schema.__name__}" except AttributeError: - new_name = f"Paged{str(item_schema).replace('.', '_')}" # typing.Any case, only for Python < 3.10 + new_name = f"Paged{str(item_schema).replace('.', '_')}" # typing.Any case, only for Python < 3.11 new_schema = type( new_name, (paginator.Output,), diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 5fa8a703..35c8b40e 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -428,11 +428,11 @@ def invalid2(request): pass -@pytest.mark.skipif(version_info < (3, 10), reason="Not needed at this Python version") +@pytest.mark.skipif(version_info < (3, 11), reason="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 """ operation = Operation("/whatever", ["GET"], lambda: None, response=List[int]) operation.response_models[200].__annotations__["response"] = List[object()]