Skip to content

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

Closed
@befeleme

Description

@befeleme

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

Activity

self-assigned this
on May 8, 2025
JelleZijlstra

JelleZijlstra commented on May 8, 2025

@JelleZijlstra
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.

added a commit that references this issue on May 8, 2025
added a commit that references this issue on May 8, 2025
added
testsTests in the Lib/test dir
3.14bugs and security fixes
on May 8, 2025
added a commit that references this issue on May 9, 2025

gh-133682: Fix inconsistent set ordering in annotationlib test (#133702)

a2a0fa9
added a commit that references this issue on May 9, 2025

pythongh-133682: Fix inconsistent set ordering in annotationlib test (p…

added a commit that references this issue on May 9, 2025

[3.14] gh-133682: Fix inconsistent set ordering in annotationlib test (

52d89f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    test.test_annotationlib.TestStringFormat.test_displays shouldn't rely on set's order of elements · Issue #133682 · python/cpython

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant