Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tests where results change in cftime 1.0.2.1 #2522

Merged
merged 1 commit into from
Oct 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions xarray/tests/test_coding_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,28 +576,24 @@ def test_infer_datetime_units(dates, expected):
assert expected == coding.times.infer_datetime_units(dates)


_CFTIME_DATETIME_UNITS_TESTS = [
([(1900, 1, 1), (1900, 1, 1)], 'days since 1900-01-01 00:00:00.000000'),
([(1900, 1, 1), (1900, 1, 2), (1900, 1, 2, 0, 0, 1)],
'seconds since 1900-01-01 00:00:00.000000'),
([(1900, 1, 1), (1900, 1, 8), (1900, 1, 16)],
'days since 1900-01-01 00:00:00.000000')
]


@pytest.mark.skipif(not has_cftime_or_netCDF4, reason='cftime not installed')
def test_infer_cftime_datetime_units():
date_types = _all_cftime_date_types()
for date_type in date_types.values():
for dates, expected in [
([date_type(1900, 1, 1),
date_type(1900, 1, 2)],
'days since 1900-01-01 00:00:00.000000'),
([date_type(1900, 1, 1, 12),
date_type(1900, 1, 1, 13)],
'seconds since 1900-01-01 12:00:00.000000'),
([date_type(1900, 1, 1),
date_type(1900, 1, 2),
date_type(1900, 1, 2, 0, 0, 1)],
'seconds since 1900-01-01 00:00:00.000000'),
([date_type(1900, 1, 1),
date_type(1900, 1, 2, 0, 0, 0, 5)],
'days since 1900-01-01 00:00:00.000000'),
([date_type(1900, 1, 1), date_type(1900, 1, 8),
date_type(1900, 1, 16)],
'days since 1900-01-01 00:00:00.000000')]:
assert expected == coding.times.infer_datetime_units(dates)
@pytest.mark.parametrize(
'calendar', _NON_STANDARD_CALENDARS + ['gregorian', 'proleptic_gregorian'])
@pytest.mark.parametrize(('date_args', 'expected'),
_CFTIME_DATETIME_UNITS_TESTS)
def test_infer_cftime_datetime_units(calendar, date_args, expected):
date_type = _all_cftime_date_types()[calendar]
dates = [date_type(*args) for args in date_args]
assert expected == coding.times.infer_datetime_units(dates)


@pytest.mark.parametrize(
Expand Down