def expand_dims(self, dims, shape=None):
        if isinstance(dims, basestring):
            dims = [dims]

        if shape is None and utils.is_dict_like(dims):
            shape = dims.values()

        missing_dims = set(self.dims) - set(dims)
        if missing_dims:
            raise ValueError('new dimensions must be a superset of existing '
                             'dimensions')

        self_dims = set(self.dims)
        expanded_dims = tuple(
            d for d in dims if d not in self_dims) + self.dims
        if shape is not None:
            dims_map = dict(zip(dims, shape))
            tmp_shape = [dims_map[d] for d in expanded_dims]
            expanded_data = ops.broadcast_to(self.data, tmp_shape)
        else:
            expanded_data = self.data[
                (None,) * (len(expanded_dims) - self.ndim)]
        expanded_var = Variable(expanded_dims, expanded_data, self._attrs,
                                self._encoding, fastpath=True)
        return expanded_var.transpose(*dims)
Re-index the search database for the unit tests.
dataset/ETHPy150Open pydata/xarray/xarray/core/variable.py/Variable.expand_dims--crossover with--dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/search/tests.py/SearchTests.reindex