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

API: add testing functions to public API ? #9895

Closed
jorisvandenbossche opened this issue Apr 14, 2015 · 10 comments
Closed

API: add testing functions to public API ? #9895

jorisvandenbossche opened this issue Apr 14, 2015 · 10 comments
Labels
API Design Docs Testing pandas testing functions or related to the test suite
Milestone

Comments

@jorisvandenbossche
Copy link
Member

A lot of other projects that use pandas will (like to) use pandas testing functionality like assert_frame_equal in their test suite. Although the pandas testing functions are available in the namespace (#6188), they are not really 'officially' labeled as public API that other projects can use (and rely upon).
Numpy has a similar submodule numpy.testing (http://docs.scipy.org/doc/numpy/reference/routines.testing.html)

Some things we could do:

  • make a selection of the functions in util.testing that we want to label as public
  • add this list somewhere to the docs
  • write docstrings for these public ones (the other could use that as well of course ..)
  • add some tests for the public API
  • I would also import them into a pandas.testing module, so it is this one we can publicly advertise (and users are less tempted to use other non-public functions in the pandas.util.testing namespace)
@jorisvandenbossche jorisvandenbossche added Testing pandas testing functions or related to the test suite API Design labels Apr 14, 2015
@jorisvandenbossche jorisvandenbossche added this to the Next Major Release milestone Apr 14, 2015
@jreback
Copy link
Contributor

jreback commented Apr 14, 2015

the 'official' way really to compare is actually .equals(...) or com.array_equivalent (which the testing functions use). So maybe make these more obvious as these are already API.

@rockg
Copy link
Contributor

rockg commented Apr 14, 2015

xref #9457 that discusses some improvements that can be made to these functions.

@jorisvandenbossche
Copy link
Member Author

OK, but .equals() is a first class citizen method, and not designed for using in a test suite. Other people have still to write there own assert_ functions that use those (the assert_frame_equal has lots of other options like non-precise, checking index names, etc).
And com.array_equivalent is something we could put in a pandas.testing module to make it public.

@jreback
Copy link
Contributor

jreback commented Apr 14, 2015

ok, so the proposition is to make a public testing module that is the API for pandas testing functions, ok, onboard with that.

@jorisvandenbossche
Copy link
Member Author

Yes indeed.
In the reasoning of "we define/provide a DataFrame object used by a lot of other projects, so we should also provide easy usable assert_ testing functionality for this object"

@jreback
Copy link
Contributor

jreback commented Apr 14, 2015

ok, so the proposal is to leave pandas.utils.testing and simply create a pandas.testing namespace that basically imports some of these names, ok, onboard with that. (and add to API docs / maybe actual docs)

@jreback jreback added the Docs label Apr 14, 2015
@jorisvandenbossche
Copy link
Member Author

That last one of pandas.testing is only a proposal of me, and certainly debatable. But I think this gives the advantage of a well defined/delineated testing module (I don't think we want to have everyting in util.testing as public?)
And that we can progressively make functions from pandas.util.testing public in pandas.testing as it seems appropriate.

It would also enable to clean up some of the functions (in argument names, defaults, ..) if this would be needed / deemed desired.

@shoyer
Copy link
Member

shoyer commented Apr 14, 2015

pandas.testing seems like a good idea to me, too.

@bashtage
Copy link
Contributor

This is a good idea - I use assert_(series,frame)_equal in both statsmodels and my own code.

@jorisvandenbossche
Copy link
Member Author

@sinhrks as you are doing quite some work on the testing functions lately, you are maybe also interested in this one? (any way, I would like to do this for 0.17.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

5 participants