From 4cbf70d53ab82360aecc265b4c966d1ab2cc078d Mon Sep 17 00:00:00 2001 From: jschendel Date: Sun, 1 Oct 2017 21:14:34 -0600 Subject: [PATCH] review updates 2 --- doc/source/timeseries.rst | 16 ++++++++-------- pandas/tests/api/test_api.py | 10 ++++++++++ .../tests/indexes/datetimes/test_date_range.py | 6 ------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/source/timeseries.rst b/doc/source/timeseries.rst index 1f3c14f7122ac..d2d5ee344591a 100644 --- a/doc/source/timeseries.rst +++ b/doc/source/timeseries.rst @@ -399,6 +399,14 @@ of those specified will not be generated: Custom Frequency Ranges ~~~~~~~~~~~~~~~~~~~~~~~ +.. warning:: + + This functionality was originally exclusive to ``cdate_range``, which is + deprecated as of version 0.21.0 in favor of ``bdate_range``. Note that + ``cdate_range`` only utilizes the ``weekmask`` and ``holidays`` parameters + when custom business day, 'C', is passed as the frequency string. Support has + been expanded with ``bdate_range`` to work with any custom frequency string. + .. versionadded:: 0.21.0 ``bdate_range`` can also generate a range of custom frequency dates by using @@ -415,14 +423,6 @@ used if a custom frequency string is passed. pd.bdate_range(start, end, freq='CBMS', weekmask=weekmask) -.. warning:: - - This functionality was originally exclusive to ``cdate_range``, which is - deprecated as of version 0.21.0 in favor of ``bdate_range``. Note that - ``cdate_range`` only utilizes the ``weekmask`` and ``holidays`` parameters - when custom business day, 'C', is passed as the frequency string. Support has - been expanded with ``bdate_range`` to work with any custom frequency string. - .. seealso:: :ref:`timeseries.custombusinessdays` diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index df101bb58047c..fad455d6391c3 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -240,3 +240,13 @@ def test_deprecation_access_func(self): [c1, c2], sort_categories=True, ignore_order=True) + + +class TestCDateRange(object): + + def test_deprecation_cdaterange(self): + # GH17596 + from pandas.core.indexes.datetimes import cdate_range + with tm.assert_produces_warning(FutureWarning, + check_stacklevel=False): + cdate_range('2017-01-01', '2017-12-31') diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index 2996502273a3a..3b40ef092f364 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -11,7 +11,6 @@ import pandas as pd import pandas.util.testing as tm from pandas import compat -from pandas.core.indexes.datetimes import cdate_range from pandas import date_range, bdate_range, offsets, DatetimeIndex, Timestamp from pandas.tseries.offsets import (generate_range, CDay, BDay, DateOffset, MonthEnd, prefix_mapping) @@ -634,8 +633,3 @@ def test_all_custom_freq(self, freq): msg = 'invalid custom frequency string: {freq}' with tm.assert_raises_regex(ValueError, msg.format(freq=bad_freq)): bdate_range(START, END, freq=bad_freq) - - def test_deprecation_cdaterange(self): - # GH17596 - with tm.assert_produces_warning(FutureWarning): - cdate_range(START, END)