Skip to content

TST: fixed cython doctests #43768

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

Merged
merged 19 commits into from
Sep 30, 2021
Merged

TST: fixed cython doctests #43768

merged 19 commits into from
Sep 30, 2021

Conversation

debnathshoham
Copy link
Member

Skipped some of the tests which were failing

@debnathshoham debnathshoham added CI Continuous Integration Docs Testing pandas testing functions or related to the test suite labels Sep 27, 2021
@debnathshoham debnathshoham marked this pull request as draft September 27, 2021 16:53
@debnathshoham debnathshoham marked this pull request as ready for review September 27, 2021 19:33
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, good to see this happening!

Couple of questions:

@debnathshoham
Copy link
Member Author

debnathshoham commented Sep 29, 2021

thanks @MarcoGorelli for reviewing this!

  • yes I think that's valid for cython docstrings as well. I have removed the # doctest: +SKIP for the line pandas supports PEP 3141 numbers: and it's running fine.

  • I have tried my best and was able to do the first two examples, but not able to replicate the third one (I don't have much experience working with tz).

So currently, only two tests are being skipped, i.e. last example in tz and Int64Factorizer.factorize in hashtable.pyx

Edit - Another point worth highlighting, is the below is failing on my local (as the output is different than from the CI).

??? >>> pd.Timestamp.fromtimestamp(1584199972)
Expected:
    Timestamp('2020-03-14 15:32:52')
Got:
    Timestamp('2020-03-14 21:02:52')

dateutil.tz.tz.tzutc

>>> tz_standardize(tz)
>>> tz_standardize(tz) # doctest: +SKIP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this need skipping?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not able to replicate this example

In [33]: from dateutil.tz.tz import tzutc as tz

In [34]: tz
Out[34]: dateutil.tz.tz.tzutc

In [35]: from pandas._libs.tslibs.timezones import tz_standardize

In [36]: tz_standardize(tz)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-36-94d2ff882b92> in <module>
----> 1 tz_standardize(tz)

TypeError: Argument 'tz' has incorrect type (expected datetime.tzinfo, got _TzSingleton)

Copy link
Member

@MarcoGorelli MarcoGorelli Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback sorry to unresolve this, but can this example be removed if it can't be run?

Co-authored-by: Marco Edward Gorelli <[email protected]>
@jbrockmendel
Copy link
Member

Edit - Another point worth highlighting, is the below is failing on my local (as the output is different than from the CI). [...] ??? >>> pd.Timestamp.fromtimestamp(1584199972)

This is going to depend on what timezone you are in locally.

@debnathshoham
Copy link
Member Author

Edit - Another point worth highlighting, is the below is failing on my local (as the output is different than from the CI). [...] ??? >>> pd.Timestamp.fromtimestamp(1584199972)

This is going to depend on what timezone you are in locally.

would be a good idea to skip this no? (or maybe make it timezone independent if possible, to ensure it doesn't fail in anyones local)

@MarcoGorelli
Copy link
Member

IMO the

In [33]: from dateutil.tz.tz import tzutc as tz

In [34]: tz
Out[34]: dateutil.tz.tz.tzutc

In [35]: from pandas._libs.tslibs.timezones import tz_standardize

In [36]: tz_standardize(tz)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-36-94d2ff882b92> in <module>
----> 1 tz_standardize(tz)

TypeError: Argument 'tz' has incorrect type (expected datetime.tzinfo, got _TzSingleton)

test can be removed, if it doesn't run.

Other than that, the rest looks good to me

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jreback jreback added this to the 1.4 milestone Sep 30, 2021
@jreback jreback merged commit 69059e8 into pandas-dev:master Sep 30, 2021
@jreback
Copy link
Contributor

jreback commented Sep 30, 2021

thanks @debnathshoham

i suppose that if we had more doc-tests in cython this would pick them up. if someone wants to create an issue about adding more doc-strings wouldn't object (for example there is an older PR that adds a ton to the timestamp functions).

@debnathshoham debnathshoham deleted the gh43757 branch September 30, 2021 19:51
gasparitiago pushed a commit to gasparitiago/pandas that referenced this pull request Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: Add doctests on cython files
4 participants