def test_from_union_fails() -> None: with pytest.raises(TypeError): Either.from_union([1, 2, 3], int, str) # type: ignore
def test_from_union_right(value: Union[A, B], left_type: Type[A], right_type: Type[B]) -> None: assert Either.from_union(value, right_type, left_type) == Either.right(value)