Skip to content

Commit 0815c43

Browse files
authored
CI: update tests for dateutil >= 2.7.0 (#20288)
closes #18332
1 parent 1cecfdf commit 0815c43

File tree

4 files changed

+1
-89
lines changed

4 files changed

+1
-89
lines changed

ci/requirements-3.6_NUMPY_DEV.build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf
1212
pip install --pre --upgrade --timeout=60 -f $PRE_WHEELS numpy scipy
1313

1414
# install dateutil from master
15-
# pip install -U git+git://github.com/dateutil/dateutil.git
16-
pip install dateutil
15+
pip install -U git+git://github.com/dateutil/dateutil.git
1716

1817
# cython via pip
1918
pip install cython

pandas/conftest.py

-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import pytest
22

3-
from distutils.version import LooseVersion
43
import numpy
54
import pandas
6-
import dateutil
75
import pandas.util._test_decorators as td
86

97

@@ -68,14 +66,6 @@ def ip():
6866
return InteractiveShell()
6967

7068

71-
is_dateutil_le_261 = pytest.mark.skipif(
72-
LooseVersion(dateutil.__version__) > LooseVersion('2.6.1'),
73-
reason="dateutil api change version")
74-
is_dateutil_gt_261 = pytest.mark.skipif(
75-
LooseVersion(dateutil.__version__) <= LooseVersion('2.6.1'),
76-
reason="dateutil stable version")
77-
78-
7969
@pytest.fixture(params=[None, 'gzip', 'bz2', 'zip',
8070
pytest.param('xz', marks=td.skip_if_no_lzma)])
8171
def compression(request):

pandas/tests/indexes/datetimes/test_tools.py

-23
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from distutils.version import LooseVersion
1313

1414
import pandas as pd
15-
from pandas.conftest import is_dateutil_le_261, is_dateutil_gt_261
1615
from pandas._libs import tslib
1716
from pandas._libs.tslibs import parsing
1817
from pandas.core.tools import datetimes as tools
@@ -1058,7 +1057,6 @@ def test_dayfirst(self, cache):
10581057
class TestGuessDatetimeFormat(object):
10591058

10601059
@td.skip_if_not_us_locale
1061-
@is_dateutil_le_261
10621060
def test_guess_datetime_format_for_array(self):
10631061
expected_format = '%Y-%m-%d %H:%M:%S.%f'
10641062
dt_string = datetime(2011, 12, 30, 0, 0, 0).strftime(expected_format)
@@ -1078,27 +1076,6 @@ def test_guess_datetime_format_for_array(self):
10781076
[np.nan, np.nan, np.nan], dtype='O'))
10791077
assert format_for_string_of_nans is None
10801078

1081-
@td.skip_if_not_us_locale
1082-
@is_dateutil_gt_261
1083-
def test_guess_datetime_format_for_array_gt_261(self):
1084-
expected_format = '%Y-%m-%d %H:%M:%S.%f'
1085-
dt_string = datetime(2011, 12, 30, 0, 0, 0).strftime(expected_format)
1086-
1087-
test_arrays = [
1088-
np.array([dt_string, dt_string, dt_string], dtype='O'),
1089-
np.array([np.nan, np.nan, dt_string], dtype='O'),
1090-
np.array([dt_string, 'random_string'], dtype='O'),
1091-
]
1092-
1093-
for test_array in test_arrays:
1094-
assert tools._guess_datetime_format_for_array(
1095-
test_array) is None
1096-
1097-
format_for_string_of_nans = tools._guess_datetime_format_for_array(
1098-
np.array(
1099-
[np.nan, np.nan, np.nan], dtype='O'))
1100-
assert format_for_string_of_nans is None
1101-
11021079

11031080
class TestToDatetimeInferFormat(object):
11041081

pandas/tests/tslibs/test_parsing.py

-54
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from dateutil.parser import parse
99

1010
import pandas.util._test_decorators as td
11-
from pandas.conftest import is_dateutil_le_261, is_dateutil_gt_261
1211
from pandas import compat
1312
from pandas.util import testing as tm
1413
from pandas._libs.tslibs import parsing
@@ -96,7 +95,6 @@ def test_parsers_monthfreq(self):
9695
class TestGuessDatetimeFormat(object):
9796

9897
@td.skip_if_not_us_locale
99-
@is_dateutil_le_261
10098
@pytest.mark.parametrize(
10199
"string, format",
102100
[
@@ -112,19 +110,6 @@ def test_guess_datetime_format_with_parseable_formats(
112110
result = parsing._guess_datetime_format(string)
113111
assert result == format
114112

115-
@td.skip_if_not_us_locale
116-
@is_dateutil_gt_261
117-
@pytest.mark.parametrize(
118-
"string",
119-
['20111230', '2011-12-30', '30-12-2011',
120-
'2011-12-30 00:00:00', '2011-12-30T00:00:00',
121-
'2011-12-30 00:00:00.000000'])
122-
def test_guess_datetime_format_with_parseable_formats_gt_261(
123-
self, string):
124-
result = parsing._guess_datetime_format(string)
125-
assert result is None
126-
127-
@is_dateutil_le_261
128113
@pytest.mark.parametrize(
129114
"dayfirst, expected",
130115
[
@@ -136,17 +121,7 @@ def test_guess_datetime_format_with_dayfirst(self, dayfirst, expected):
136121
ambiguous_string, dayfirst=dayfirst)
137122
assert result == expected
138123

139-
@is_dateutil_gt_261
140-
@pytest.mark.parametrize(
141-
"dayfirst", [True, False])
142-
def test_guess_datetime_format_with_dayfirst_gt_261(self, dayfirst):
143-
ambiguous_string = '01/01/2011'
144-
result = parsing._guess_datetime_format(
145-
ambiguous_string, dayfirst=dayfirst)
146-
assert result is None
147-
148124
@td.skip_if_has_locale
149-
@is_dateutil_le_261
150125
@pytest.mark.parametrize(
151126
"string, format",
152127
[
@@ -158,19 +133,6 @@ def test_guess_datetime_format_with_locale_specific_formats(
158133
result = parsing._guess_datetime_format(string)
159134
assert result == format
160135

161-
@td.skip_if_has_locale
162-
@is_dateutil_gt_261
163-
@pytest.mark.parametrize(
164-
"string",
165-
[
166-
'30/Dec/2011',
167-
'30/December/2011',
168-
'30/Dec/2011 00:00:00'])
169-
def test_guess_datetime_format_with_locale_specific_formats_gt_261(
170-
self, string):
171-
result = parsing._guess_datetime_format(string)
172-
assert result is None
173-
174136
def test_guess_datetime_format_invalid_inputs(self):
175137
# A datetime string must include a year, month and a day for it
176138
# to be guessable, in addition to being a string that looks like
@@ -189,7 +151,6 @@ def test_guess_datetime_format_invalid_inputs(self):
189151
for invalid_dt in invalid_dts:
190152
assert parsing._guess_datetime_format(invalid_dt) is None
191153

192-
@is_dateutil_le_261
193154
@pytest.mark.parametrize(
194155
"string, format",
195156
[
@@ -204,21 +165,6 @@ def test_guess_datetime_format_nopadding(self, string, format):
204165
result = parsing._guess_datetime_format(string)
205166
assert result == format
206167

207-
@is_dateutil_gt_261
208-
@pytest.mark.parametrize(
209-
"string",
210-
[
211-
'2011-1-1',
212-
'30-1-2011',
213-
'1/1/2011',
214-
'2011-1-1 00:00:00',
215-
'2011-1-1 0:0:0',
216-
'2011-1-3T00:00:0'])
217-
def test_guess_datetime_format_nopadding_gt_261(self, string):
218-
# GH 11142
219-
result = parsing._guess_datetime_format(string)
220-
assert result is None
221-
222168

223169
class TestArrayToDatetime(object):
224170
def test_try_parse_dates(self):

0 commit comments

Comments
 (0)