[python] fix uniqueItems validation tests#24092
Merged
wing328 merged 1 commit intoJun 22, 2026
Merged
Conversation
fb37fcc to
8d0a632
Compare
8d0a632 to
013d287
Compare
Pydantic 2 removed conlist(unique_items=True). The migration in 04fa53b kept OpenAPI arrays as lists because sets would lose ordering and complicate JSON serialization, but left the old validation tests in the synchronous and lazy-import samples. Those tests do not require an exception, so they normally pass after making a Petstore request and fail only when that request produces an unrelated response validation error. Remove them from the Pydantic 2 samples. Pydantic 1 still enforces uniqueItems. Make its test require the expected validation error so a regression cannot silently pass.
013d287 to
cb5bb55
Compare
Contributor
Author
|
Also sent #24093 to cover incomplete triggers for this workflow. |
Member
|
thanks for addressing the outdated tests cc @cbornet (2017/09) @tomplus (2018/10) @krjakbrjak (2023/02) @fa0311 (2023/10) @multani (2023/10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pydantic 2 removed
conlist(unique_items=True). The migration in04fa53b kept OpenAPI arrays as lists because sets would lose ordering
and complicate JSON serialization, but left these tests behind.
The tests do not require an exception, so they normally pass after
making a Petstore request. They fail when that request produces an
unrelated response validation error. Remove them from the two Pydantic 2
samples; the Pydantic 1 sample still exercises the supported validation.
Summary by cubic
Remove duplicate-item validation tests from Petstore samples on
pythonandpython-lazyImports(Pydantic v2) to align with removal ofconlist(unique_items=True)and eliminate flaky failures. Inpython-pydantic-v1, require the expected ValidationError withassertRaisesRegex("the list has duplicated items")to prevent silent regressions.Written for commit cb5bb55. Summary will update on new commits.