Skip to content

test(python-flask): fix the stale assertion and re-enable testControllerTestModelExampleUsesImportedName - #25552

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
khayashi4337:fix/python-flask-reenable-imported-name-test
Nov 4, 2026
Merged

wing328 merged 1 commit into
OpenAPITools:masterfrom
khayashi4337:fix/python-flask-reenable-imported-name-test

Conversation

@khayashi4337

@khayashi4337 khayashi4337 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Re-enables PythonFlaskConnexionServerCodegenTest.testControllerTestModelExampleUsesImportedName, which was disabled in #25519 after failing on master.

Why it failed

#25426 added the test expecting query_string = [('filter', Filter()),]. Independently merged changes (#25485 / the object-typed parameter work in #25427, #25450) changed how the generated controller test renders those parameters, so the line the test looked for no longer exists. The generated code is correct; the assertion was stale.

The generated test_default_controller.py now sends each parameter in its OpenAPI wire style instead of a Python repr:

        query_string = [('name', 'name_example'),          # filter (object, form/explode)
                        ('filters', [Filter()]),            # array of Filter
                        ('filterMap', {'key': Filter()}),   # map of Filter
                        ('count', openapi_server.int()),
                        ('label', 'openapi_server.Filter()'),
                        ('status', 'open')]
        headers = {
            'X-Trace': 'id,id_example',                     # Trace (object, simple style)
        }

and the body parameter uses the sanitized name filter_ = Filter() (#25450).

What changed

The test now expects the current rendering while keeping its original purpose — model examples use the imported class name ([Filter()], {'key': Filter()}, filter_ = Filter()), never the package-qualified openapi_server.Filter()/openapi_server.Trace() (still asserted via assertFileNotContains).

Test results

  • PythonFlaskConnexionServerCodegenTest + AbstractPythonConnexionServerCodegenTest: 48 tests run, 0 failures (baseline on master without this change: 47 run, 0 failures — the disabled test simply did not execute).
  • Reproduced the failure first: re-enabling the test without the assertion fix fails on Linux with the same missing line wing328 reported on Windows (query_string = [('filter', Filter()),]).
  • ./mvnw -DskipTests verify passes (checkstyle, forbiddenapis, coverage checks all clean).

Follow-up to #25519 (requested by @wing328).


🤖 Generated with Claude Code


Summary by cubic

Re-enables testControllerTestModelExampleUsesImportedName, which was disabled in #25519 because it asserted a rendering of model-typed parameters that no longer matches the generated code. Query and header model parameters are now emitted in OpenAPI wire style (form/explode pairs, simple-style values) and the body parameter is sanitized to filter_, so the test expectations are updated to the current output. The test still verifies its original purpose: model examples use the imported class name ([Filter()], {'key': Filter()}, filter_ = Filter()), never the package-qualified openapi_server.Filter()/openapi_server.Trace().

Written for commit b8d4a9e. Summary will update on new commits.

View guided diff

…lerTestModelExampleUsesImportedName

The test was disabled in OpenAPITools#25519 because its query_string assertion
expected the pre-OpenAPITools#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 OpenAPITools#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 <noreply@anthropic.com>
@khayashi4337 khayashi4337 mentioned this pull request Nov 4, 2026
3 tasks

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

View guided diff | Re-trigger cubic

@wing328
wing328 merged commit e306772 into OpenAPITools:master Nov 4, 2026
15 checks passed
@wing328 wing328 added this to the 7.28.0 milestone Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants