MCPcopy Index your code
hub / github.com/pydata/xarray / test_cftime_range_no_freq

Function test_cftime_range_no_freq

xarray/tests/test_cftime_offsets.py:1718–1728  ·  view source on GitHub ↗

Test whether date_range produces the same result as Pandas when freq is not provided, but start, end and periods are.

(start, end, periods)

Source from the content-addressed store, hash-verified

1716 ],
1717)
1718def test_cftime_range_no_freq(start, end, periods):
1719 """
1720 Test whether date_range produces the same result as Pandas
1721 when freq is not provided, but start, end and periods are.
1722 """
1723 # Generate date ranges using cftime_range
1724 cftimeindex = date_range(start=start, end=end, periods=periods, use_cftime=True)
1725 result = cftimeindex.to_datetimeindex(time_unit="ns")
1726 expected = pd.date_range(start=start, end=end, periods=periods)
1727
1728 np.testing.assert_array_equal(result, expected)
1729
1730
1731@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

date_rangeFunction · 0.90
to_datetimeindexMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…