From 305de57eff21fee473adb22b1550d670f190bc59 Mon Sep 17 00:00:00 2001 From: GareArc Date: Tue, 5 May 2026 19:39:49 -0700 Subject: [PATCH] test(openapi): tighten PEP 695 generic assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous test asserted only that model_fields exposed the expected names — the legacy Generic[T] form would have passed identically. Switch to __type_params__, which is non-empty only under PEP 695 native syntax. --- .../controllers/openapi/test_pagination_envelope.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/tests/unit_tests/controllers/openapi/test_pagination_envelope.py b/api/tests/unit_tests/controllers/openapi/test_pagination_envelope.py index 9fb4120d14..a765e86241 100644 --- a/api/tests/unit_tests/controllers/openapi/test_pagination_envelope.py +++ b/api/tests/unit_tests/controllers/openapi/test_pagination_envelope.py @@ -52,11 +52,12 @@ def test_max_page_limit_is_200(): def test_envelope_uses_pep695_generics(): - """Verify the class accepts type parameter via PEP 695 syntax — - i.e., model_fields surfaces the generic-parameterized data list.""" + """Verify the class uses PEP 695 native generic syntax (not legacy Generic[T]).""" from controllers.openapi._models import PaginationEnvelope - Parameterized = PaginationEnvelope[dict] + # PEP 695 syntax populates __type_params__; the legacy Generic[T] form does not. + assert PaginationEnvelope.__type_params__, "expected PEP 695 native generic syntax" + fields = PaginationEnvelope.model_fields assert {"page", "limit", "total", "has_more", "data"} <= set(fields)