Skip to content

Commit

Permalink
nevermind
Browse files Browse the repository at this point in the history
  • Loading branch information
c4ffein committed Aug 23, 2024
1 parent ab98221 commit 37d9711
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ninja/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down

0 comments on commit 37d9711

Please sign in to comment.