|
19 | 19 | from pandas.compat.numpy import np_array_datetime64_compat
|
20 | 20 |
|
21 | 21 | import pandas as pd
|
22 |
| -from pandas import DataFrame, DatetimeIndex, Index, MultiIndex |
| 22 | +from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, Series |
23 | 23 | from pandas.core.indexes.datetimes import date_range
|
24 | 24 | import pandas.util.testing as tm
|
25 | 25 |
|
26 | 26 | import pandas.io.date_converters as conv
|
27 |
| -import pandas.io.parsers as parsers |
28 | 27 |
|
29 | 28 | # constant
|
30 | 29 | _DEFAULT_DATETIME = datetime(1, 1, 1)
|
@@ -117,6 +116,18 @@ def date_parser(*date_cols):
|
117 | 116 | tm.assert_frame_equal(result, expected)
|
118 | 117 |
|
119 | 118 |
|
| 119 | +@pytest.mark.parametrize("container", [list, tuple, Index, Series]) |
| 120 | +@pytest.mark.parametrize("dim", [1, 2]) |
| 121 | +def test_concat_date_col_fail(container, dim): |
| 122 | + msg = "not all elements from date_cols are numpy arrays" |
| 123 | + value = "19990127" |
| 124 | + |
| 125 | + date_cols = tuple(container([value]) for _ in range(dim)) |
| 126 | + |
| 127 | + with pytest.raises(ValueError, match=msg): |
| 128 | + parsing._concat_date_cols(date_cols) |
| 129 | + |
| 130 | + |
120 | 131 | @pytest.mark.parametrize("keep_date_col", [True, False])
|
121 | 132 | def test_multiple_date_col(all_parsers, keep_date_col):
|
122 | 133 | data = """\
|
|
0 commit comments