def box_expected(expected, box_cls, transpose=True):
if box_cls is pd.Index:<EOL><INDENT>expected = pd.Index(expected)<EOL><DEDENT>elif box_cls is pd.Series:<EOL><INDENT>expected = pd.Series(expected)<EOL><DEDENT>elif box_cls is pd.DataFrame:<EOL><INDENT>expected = pd.Series(expected).to_frame()<EOL>if transpose:<EOL><INDENT>expected = expected.T<EOL><DEDENT><DEDENT>elif box_cls is PeriodArray:<EOL><INDENT>expected = period_array(expected)<EOL><DEDENT>elif box_cls is DatetimeArray:<EOL><INDENT>expected = DatetimeArray(expected)<EOL><DEDENT>elif box_cls is TimedeltaArray:<EOL><INDENT>expected = TimedeltaArray(expected)<EOL><DEDENT>elif box_cls is np.ndarray:<EOL><INDENT>expected = np.array(expected)<EOL><DEDENT>elif box_cls is to_array:<EOL><INDENT>expected = to_array(expected)<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError(box_cls)<EOL><DEDENT>return expected<EOL>
Helper function to wrap the expected output of a test in a given box_class.

Parameters
----------
expected : np.ndarray, Index, Series
box_cls : {Index, Series, DataFrame}

Returns
-------
subclass of box_cls