From b8d4a9ecf0a0b7c69c3c0a4de1cd0a220f1c7042 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 4 Nov 2026 12:36:23 +0900 Subject: [PATCH] test(python-flask): fix the stale assertion and re-enable testControllerTestModelExampleUsesImportedName The test was disabled in #25519 because its query_string assertion expected the pre-#25485 rendering ('filter', Filter()). Object-typed query/header parameters are now sent in their OpenAPI wire style (form/explode pairs for the query object, a simple-style value for the header), and the body parameter is renamed to filter_ per #25450. Update the expectations to the current generated output while keeping the test's purpose: model examples still use the imported class name ([Filter()], {'key': Filter()}, filter_ = Filter()), never the package-qualified openapi_server.Filter()/openapi_server.Trace(). Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 --- .../python/PythonFlaskConnexionServerCodegenTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFlaskConnexionServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFlaskConnexionServerCodegenTest.java index ecdd8202e5de..c91d7fc6844a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFlaskConnexionServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFlaskConnexionServerCodegenTest.java @@ -165,7 +165,7 @@ public void testDefaultController() throws IOException { "Untagged operations should honor defaultController, not fall back to default_controller.py"); } - @Test(description = "model examples in generated controller tests use the imported class name, not the package", enabled = false) + @Test(description = "model examples in generated controller tests use the imported class name, not the package") public void testControllerTestModelExampleUsesImportedName() throws IOException { final DefaultCodegen codegen = new PythonFlaskConnexionServerCodegen(); final String outputPath = generateFiles(codegen, "src/test/resources/3_0/python-flask/model-typed-params.yaml"); @@ -176,11 +176,13 @@ public void testControllerTestModelExampleUsesImportedName() throws IOException assertFileContains(controllerTest, "from openapi_server.models.filter import Filter", "from openapi_server.models.trace import Trace", - "query_string = [('filter', Filter()),", + // a model-typed query parameter is sent as form/explode wire pairs, not a Filter() repr + "query_string = [('name', 'name_example'),", "('filters', [Filter()]),", "('filterMap', {'key': Filter()}),", - "filter = Filter()", - ": Trace(),"); + "filter_ = Filter()", + // a model-typed header is sent as its simple-style wire value, not a Trace() repr + "'X-Trace': 'id,id_example',"); // User-supplied examples that merely look like a constructor are kept verbatim. assertFileContains(controllerTest, "('label', 'openapi_server.Filter()')", "('count', openapi_server.int())"); // A model-typed parameter with a default keeps the default as its example.