MCPcopy
hub / github.com/pydata/xarray / test_date_range_like

Function test_date_range_like

xarray/tests/test_cftime_offsets.py:1464–1481  ·  view source on GitHub ↗
(start, freq, cal_src, cal_tgt, use_cftime, exp0, exp_pd)

Source from the content-addressed store, hash-verified

1462 ],
1463)
1464def test_date_range_like(start, freq, cal_src, cal_tgt, use_cftime, exp0, exp_pd):
1465 expected_freq = freq
1466
1467 source = date_range(start, periods=12, freq=freq, calendar=cal_src)
1468
1469 out = date_range_like(source, cal_tgt, use_cftime=use_cftime)
1470
1471 assert len(out) == 12
1472
1473 assert infer_freq(out) == expected_freq
1474
1475 assert out[0].isoformat().startswith(exp0)
1476
1477 if exp_pd:
1478 assert isinstance(out, pd.DatetimeIndex)
1479 else:
1480 assert isinstance(out, CFTimeIndex)
1481 assert out.calendar == cal_tgt
1482
1483
1484@requires_cftime

Callers

nothing calls this directly

Calls 4

date_rangeFunction · 0.90
date_range_likeFunction · 0.90
infer_freqFunction · 0.90
startswithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…