MCPcopy Index your code
hub / github.com/python/cpython / test_order_in_union

Method test_order_in_union

Lib/test/test_typing.py:9662–9671  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

9660 Union[int, Annotated[int, {}]])
9661
9662 def test_order_in_union(self):
9663 expr1 = Annotated[int, 1] | str | Annotated[str, {}] | int
9664 for args in itertools.permutations(get_args(expr1)):
9665 with self.subTest(args=args):
9666 self.assertEqual(expr1, reduce(operator.or_, args))
9667
9668 expr2 = Union[Annotated[int, 1], str, Annotated[str, {}], int]
9669 for args in itertools.permutations(get_args(expr2)):
9670 with self.subTest(args=args):
9671 self.assertEqual(expr2, Union[args])
9672
9673 def test_specialize(self):
9674 L = Annotated[List[T], "my decoration"]

Callers

nothing calls this directly

Calls 4

get_argsFunction · 0.90
reduceFunction · 0.90
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected