|
2 | 2 |
|
3 | 3 | import calendar
|
4 | 4 | from collections import deque
|
5 |
| -from datetime import datetime, time, timedelta |
| 5 | +from datetime import datetime, timedelta |
6 | 6 | import locale
|
7 | 7 |
|
8 | 8 | from dateutil.parser import parse
|
@@ -2112,52 +2112,6 @@ def test_parsers_timestring(self, cache):
|
2112 | 2112 | assert result4 == exp_now
|
2113 | 2113 | assert result5 == exp_now
|
2114 | 2114 |
|
2115 |
| - @td.skip_if_has_locale |
2116 |
| - def test_parsers_time(self): |
2117 |
| - # GH11818 |
2118 |
| - strings = [ |
2119 |
| - "14:15", |
2120 |
| - "1415", |
2121 |
| - "2:15pm", |
2122 |
| - "0215pm", |
2123 |
| - "14:15:00", |
2124 |
| - "141500", |
2125 |
| - "2:15:00pm", |
2126 |
| - "021500pm", |
2127 |
| - time(14, 15), |
2128 |
| - ] |
2129 |
| - expected = time(14, 15) |
2130 |
| - |
2131 |
| - for time_string in strings: |
2132 |
| - assert tools.to_time(time_string) == expected |
2133 |
| - |
2134 |
| - new_string = "14.15" |
2135 |
| - msg = r"Cannot convert arg \['14\.15'\] to a time" |
2136 |
| - with pytest.raises(ValueError, match=msg): |
2137 |
| - tools.to_time(new_string) |
2138 |
| - assert tools.to_time(new_string, format="%H.%M") == expected |
2139 |
| - |
2140 |
| - arg = ["14:15", "20:20"] |
2141 |
| - expected_arr = [time(14, 15), time(20, 20)] |
2142 |
| - assert tools.to_time(arg) == expected_arr |
2143 |
| - assert tools.to_time(arg, format="%H:%M") == expected_arr |
2144 |
| - assert tools.to_time(arg, infer_time_format=True) == expected_arr |
2145 |
| - assert tools.to_time(arg, format="%I:%M%p", errors="coerce") == [None, None] |
2146 |
| - |
2147 |
| - res = tools.to_time(arg, format="%I:%M%p", errors="ignore") |
2148 |
| - tm.assert_numpy_array_equal(res, np.array(arg, dtype=np.object_)) |
2149 |
| - |
2150 |
| - with pytest.raises(ValueError): |
2151 |
| - tools.to_time(arg, format="%I:%M%p", errors="raise") |
2152 |
| - |
2153 |
| - tm.assert_series_equal( |
2154 |
| - tools.to_time(Series(arg, name="test")), Series(expected_arr, name="test") |
2155 |
| - ) |
2156 |
| - |
2157 |
| - res = tools.to_time(np.array(arg)) |
2158 |
| - assert isinstance(res, list) |
2159 |
| - assert res == expected_arr |
2160 |
| - |
2161 | 2115 | @pytest.mark.parametrize("cache", [True, False])
|
2162 | 2116 | @pytest.mark.parametrize(
|
2163 | 2117 | "dt_string, tz, dt_string_repr",
|
|
0 commit comments