From 739861bfea02bb84af36bf8f0ad2ed88a5327bd8 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Thu, 24 Aug 2017 08:46:33 -0700 Subject: [PATCH 1/4] Fix typo that causes several NaT methods to have incorrect docstrings --- pandas/_libs/tslib.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index c4a38ec660a4c..d579158d67b44 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -3925,7 +3925,7 @@ for _method_name in _nat_methods: def f(*args, **kwargs): return NaT f.__name__ = func_name - f.__doc__ = _get_docstring(_method_name) + f.__doc__ = _get_docstring(func_name) return f setattr(NaTType, _method_name, _make_nat_func(_method_name)) @@ -3937,7 +3937,7 @@ for _method_name in _nan_methods: def f(*args, **kwargs): return np.nan f.__name__ = func_name - f.__doc__ = _get_docstring(_method_name) + f.__doc__ = _get_docstring(func_name) return f setattr(NaTType, _method_name, _make_nan_func(_method_name)) @@ -3955,7 +3955,7 @@ for _maybe_method_name in dir(NaTType): def f(*args, **kwargs): raise ValueError("NaTType does not support " + func_name) f.__name__ = func_name - f.__doc__ = _get_docstring(_method_name) + f.__doc__ = _get_docstring(func_name) return f setattr(NaTType, _maybe_method_name, From ba511a74d5efe68f73a267481ab94ce8af414997 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 25 Aug 2017 11:47:49 -0700 Subject: [PATCH 2/4] test for ctime.__doc__, note for whatsnew --- doc/source/whatsnew/v0.21.0.txt | 1 + pandas/tests/scalar/test_nat.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt index fcadd26156b1d..8b991eead5185 100644 --- a/doc/source/whatsnew/v0.21.0.txt +++ b/doc/source/whatsnew/v0.21.0.txt @@ -423,3 +423,4 @@ Categorical Other ^^^^^ - Bug in :func:`eval` where the ``inplace`` parameter was being incorrectly handled (:issue:`16732`) +- Several ``NaT`` method docstrings (e.g. :func:`NaT.ctime`) were incorrect diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 5f247cae1099b..6f852f2b394e1 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -247,3 +247,8 @@ def test_nat_arithmetic_index(): tm.assert_index_equal(right + left, exp) tm.assert_index_equal(left - right, exp) tm.assert_index_equal(right - left, exp) + + +def test_nat_pinned_docstrings(): + # GH17327 + assert NaT.ctime.__doc__ == datetime.ctime.__doc__ From 9fc30cb7f6cb0687c9ee92aca75ec6e6be891d9c Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Mon, 28 Aug 2017 07:56:17 -0700 Subject: [PATCH 3/4] dummy commit to force CI --- pandas/_libs/tslib.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index d579158d67b44..9df8cdfe91f9f 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # cython: profile=False import warnings From eb9a042c21f2f8cb2db541ac080436569b2e90f7 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Tue, 29 Aug 2017 07:21:30 -0700 Subject: [PATCH 4/4] Add GH reference in whatsnew Not sure if there is a label specifically for PR, so labelled it as issue --- doc/source/whatsnew/v0.21.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt index 8b991eead5185..7eb4da981888f 100644 --- a/doc/source/whatsnew/v0.21.0.txt +++ b/doc/source/whatsnew/v0.21.0.txt @@ -423,4 +423,4 @@ Categorical Other ^^^^^ - Bug in :func:`eval` where the ``inplace`` parameter was being incorrectly handled (:issue:`16732`) -- Several ``NaT`` method docstrings (e.g. :func:`NaT.ctime`) were incorrect +- Several ``NaT`` method docstrings (e.g. :func:`NaT.ctime`) were incorrect (:issue:`17327`)