We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9546eee commit 1cef6e5Copy full SHA for 1cef6e5
Lib/test/test_annotationlib.py
@@ -393,6 +393,17 @@ def g(
393
"z": "a[(int, str), 5]",
394
},
395
)
396
+
397
+ def test_set_ordering_consistency(self):
398
+ """Test that sets of types are consistently ordered in string representations."""
399
+ # Test with direct set annotations
400
+ def g1(x: {int, str}):
401
+ pass
402
403
+ anno_g1 = get_annotations(g1, format=Format.STRING)
404
405
+ # The set should have elements sorted by name (int before str)
406
+ self.assertEqual(anno_g1["x"], "{int, str}")
407
408
def test_nested_expressions(self):
409
def f(
0 commit comments