MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_order_in_union

Method test_order_in_union

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

Source from the content-addressed store, hash-verified

9536 Union[int, Annotated[int, {}]])
9537
9538 def test_order_in_union(self):
9539 expr1 = Annotated[int, 1] | str | Annotated[str, {}] | int
9540 for args in itertools.permutations(get_args(expr1)):
9541 with self.subTest(args=args):
9542 self.assertEqual(expr1, reduce(operator.or_, args))
9543
9544 expr2 = Union[Annotated[int, 1], str, Annotated[str, {}], int]
9545 for args in itertools.permutations(get_args(expr2)):
9546 with self.subTest(args=args):
9547 self.assertEqual(expr2, Union[args])
9548
9549 def test_specialize(self):
9550 L = Annotated[List[T], "my decoration"]

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected