Skip to content

test.test_annotationlib.TestStringFormat.test_displays shouldn't rely on set's order of elements #133682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
befeleme opened this issue May 8, 2025 · 1 comment
Assignees
Labels
3.14 bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@befeleme
Copy link
Contributor

befeleme commented May 8, 2025

Bug report

Bug description:

We've hit a failure during Python's 3.14.0b1 build - test apparently checks for an exact order of elements in a set which will sometimes fail:

FAIL: test_displays (test.test_annotationlib.TestStringFormat.test_displays)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3.14-3.14.0_b1-build/Python-3.14.0b1/Lib/test/test_annotationlib.py", line 349, in test_displays
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        anno,
        ^^^^^
    ...<5 lines>...
        },
        ^^
    )
    ^
AssertionError: {'w':[29 chars] 'a[{str, int}, 3]', 'y': 'a[{int: str}, 4]', [19 chars] 5]'} != {'w':[29 chars] 'a[{int, str}, 3]', 'y': 'a[{int: str}, 4]', [19 chars] 5]'}
  {'w': 'a[[int, str], float]',
-  'x': 'a[{str, int}, 3]',
?              -----
+  'x': 'a[{int, str}, 3]',
?           +++++
   'y': 'a[{int: str}, 4]',
   'z': 'a[(int, str), 5]'}

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

@befeleme befeleme added the type-bug An unexpected behavior, bug, or error label May 8, 2025
@JelleZijlstra JelleZijlstra self-assigned this May 8, 2025
@JelleZijlstra
Copy link
Member

Surprised I never ran into this running the test locally. Should be fixable by making the test use a one-element set; I'll do this soon unless somebody else gets to it first.

akshat62 added a commit to akshat62/cpython that referenced this issue May 8, 2025
Fix inconsistent set ordering in annotations (pythonGH-133682)
akshat62 added a commit to akshat62/cpython that referenced this issue May 8, 2025
@picnixz picnixz added tests Tests in the Lib/test dir 3.14 bugs and security fixes labels May 8, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 9, 2025
…ythonGH-133702)

(cherry picked from commit a2a0fa9)

Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
JelleZijlstra pushed a commit that referenced this issue May 9, 2025
…GH-133702) (#133754)

gh-133682: Fix inconsistent set ordering in annotationlib test (GH-133702)
(cherry picked from commit a2a0fa9)

Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
@hugovk hugovk closed this as completed May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants