def build_shapes(
    string: str, dimension_dict: Optional[Dict[str, int]] = None, replace_ellipsis: bool = False
) -> Tuple[TensorShapeType, ...]:
    """Builds random tensor shapes for testing.

    Parameters:
        string: List of tensor strings to build
        dimension_dict: Dictionary of index sizes, defaults to indices size of 2-7
        replace_ellipsis: Replace ellipsis with a string of no collision characters

    Returns:
        The resulting shapes.

    Examples:
        ```python
        >>> shapes = build_shapes('abbc', {'a': 2, 'b':3, 'c':5})
        >>> shapes
        [(2, 3), (3, 3, 5), (5,)]
        ```

    """
    if dimension_dict is None:
        dimension_dict = _default_dim_dict

    if "..." in string:
        if replace_ellipsis is False:
            raise ValueError(
                "Ellipsis found in string but `replace_ellipsis=False`, use `replace_ellipsis=True` if this behavior is desired."
            )
        ellipse_replace = _no_collision_chars[:3]
        string = string.replace("...", ellipse_replace)

    shapes = []
    terms = string.split("->")[0].split(",")
    for term in terms:
        dims = [dimension_dict[x] for x in term]
        shapes.append(tuple(dims))
    return tuple(shapes)
Builds random tensor shapes for testing.

    Parameters:
        string: List of tensor strings to build
        dimension_dict: Dictionary of index sizes, defaults to indices size of 2-7
        replace_ellipsis: Replace ellipsis with a string of no collision characters

    Returns:
        The resulting shapes.

    Examples:
        ```python
        >>> shapes = build_shapes('abbc', {'a': 2, 'b':3, 'c':5})
        >>> shapes
        [(2, 3), (3, 3, 5), (5,)]
        ```

    
opt_einsum/testing.py