Skip to content
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

Travis CI: issue with python 3.5 and doctest #270

Closed
garawalid opened this issue May 8, 2019 · 6 comments · Fixed by #274
Closed

Travis CI: issue with python 3.5 and doctest #270

garawalid opened this issue May 8, 2019 · 6 comments · Fixed by #274

Comments

@garawalid
Copy link
Contributor

Travis CI with python 3.5 returns different results than expected in doctest.
Here is an example :

        >>> df = ks.DataFrame({'name': ['Raphael', 'Donatello'],
        ...                    'mask': ['red', 'purple'],
        ...                    'weapon': ['sai', 'bo staff']})
        >>> df.to_csv(index=False)
Expected:
    'name,mask,weapon\nRaphael,red,sai\nDonatello,purple,bo staff\n'
Got:
    'mask,name,weapon\nred,Raphael,sai\npurple,Donatello,bo staff\n'

I check doctest with Pandas 0.23.4 and python 3.6 locally and everything works well.

We had this issue in these PRs: #239 #238 #267

@HyukjinKwon
Copy link
Member

I think this is an issue inherited from Pandas. You can use ... for now

@arisehkawamura
Copy link

Hope this helps

Are dictionaries ordered in Python 3.6+? - Stack Overflow

@HyukjinKwon
Copy link
Member

Thanks, either way looks not specific to this library.

@ueshin
Copy link
Collaborator

ueshin commented May 9, 2019

We can't leave the flakiness.

I guess we can fix by explicitly reordering columns after df is created, or avoiding using dict.

df = ks.DataFrame({ ... })
df = df[['name', 'mask', 'weapon']]

or

df = ks.DataFrame([['Raphael', 'red', 'sal'],
                   ['Donatello', 'purple', 'bo staff']],
                  columns=['name', 'mask', 'weapon'])

Let me fix the existing tests.

@ueshin ueshin reopened this May 9, 2019
@ueshin
Copy link
Collaborator

ueshin commented May 9, 2019

Seems columns=[...] works:

df = ks.DataFrame({ ... }, columns=['name', 'mask', 'weapon'])

@ueshin ueshin mentioned this issue May 9, 2019
HyukjinKwon pushed a commit that referenced this issue May 9, 2019
In Python 3.5, using `dict` causes doctest flakiness.
This PR tries to fix the flakiness by explicitly specifying `columns=[...]` or sorting the result.
Resolves #270.
@garawalid
Copy link
Contributor Author

I agree columns=[...] works. Still, some cases where we have to skip them by # doctest: +SKIP.
Example DataFrame.to_json #238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants