From a93a92f187a8c985e71870f06624c4d2c01e12c5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 28 Mar 2026 06:47:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_duplicate_operation_id.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_duplicate_operation_id.py b/tests/test_duplicate_operation_id.py index 437311ec57..f7d02249d4 100644 --- a/tests/test_duplicate_operation_id.py +++ b/tests/test_duplicate_operation_id.py @@ -1,4 +1,5 @@ """Test for fix of issue #13175: duplicate operation IDs with multi-method routes""" + from fastapi import FastAPI from fastapi.testclient import TestClient @@ -14,37 +15,37 @@ def test_no_duplicate_operation_ids_with_multiple_methods(): client = TestClient(app) response = client.get("/openapi.json") assert response.status_code == 200 - + data = response.json() - + # Check that all three methods exist in the OpenAPI schema paths = data.get("paths", {}) items_path = paths.get("/items/", {}) - + assert "get" in items_path assert "post" in items_path assert "delete" in items_path - + # Verify each method has a unique operation ID get_op_id = items_path["get"].get("operationId") post_op_id = items_path["post"].get("operationId") delete_op_id = items_path["delete"].get("operationId") - + # All should exist assert get_op_id is not None assert post_op_id is not None assert delete_op_id is not None - + # All should be different assert get_op_id != post_op_id assert get_op_id != delete_op_id assert post_op_id != delete_op_id - + # Verify they follow the pattern: __ assert "handle_items_items_" in get_op_id assert "handle_items_items_" in post_op_id assert "handle_items_items_" in delete_op_id - + assert "_get" in get_op_id assert "_post" in post_op_id assert "_delete" in delete_op_id @@ -53,4 +54,3 @@ def test_no_duplicate_operation_ids_with_multiple_methods(): if __name__ == "__main__": test_no_duplicate_operation_ids_with_multiple_methods() print("✓ Test passed!") -