Status: Accepted
Owner: asmeurer
CC: mattpap
Labels: Type-Defect Priority-Medium NeedsReview

New issue 1949 by asmeurer: Doctests for polynomials module
http://code.google.com/p/sympy/issues/detail?id=1949

As the first part of my Google Summer of Code project, I undertook to write doctests for most of the functions and methods in the polynomials module. Wow! There were a lot of them, but this has been by far the most efficient way of learning the in's and out's of a module I have ever tried, and I would highly recommend it. I now feel that I understand most parts of the module almost as well as if I had written it. See http://github.com/asmeurer/sympy/tree/polydocs-polys9.

A few notes:

- I have based the branch on top of my branch from issue 1883, and that one on top of Mateusz's polys9. The reason is that I didn't want to go fixing things that were already fixed by me or him somewhere else (indeed, I started working on top of master, and I fixed at least 2 things that got rebased out when I moved to the top of polys9 because Mateusz already fixed them there). So I am not sure what should be done about this. I guess if Mateusz reviews it positively, he can just continue his work on top of my branch as I have with his. polys9 still needs to be rebased over master, and there will be some non-trivial merge issues with that. I will also gladly merge this over
a more recent polys9 or a polys10 myself if that makes things easier.

- Aside from doctests, there were also several other changes. Most of these are fixes to bugs that I encountered in the polys module. A few are in the spirit of issue 1883. A couple also relate to fixes
with the coverage_doctest utility.

- Specifically, regarding the coverage_doctest utility, I made it executable, and made it skip test_ and bench_ files, whose functions do not need doctests. Also, this is the tool that I used as the guide for which functions to add doctests to. Therefore, I didn't add any doctests to class
definitions or internal methods.

- I did not add doctests to *all* functions and methods in polys. Rather, I added doctests to the most important ones, including all from densebasic.py, densetools.py, densearith.py, galoistools.py, and polytools.py and most from polyclasses.py and algebratools.py. I may go on to do others such as groebnertools.py later if I find myself needing those functions for my work or if I get bored :).

- It is very important to test using all three ground types and all three pythons. In addition, some doctests were required to be coded so that they pass in systems that do and do not have gmpy installed. One of the changes I made was to print the SYMPY_GROUND_TYPES at the top of any test or doctest run, so that we can see exactly where things are happening. On my machine I used this alias to test (the /sw/bin/python's have gmpy installed whereas other ones do not): alias doctestall='SYMPY_GROUND_TYPES=gmpy /sw/bin/python2.6 bin/doctest sympy/polys/; SYMPY_GROUND_TYPES=gmpy python2.5 bin/doctest sympy/polys/; SYMPY_GROUND_TYPES=gmpy python2.6 bin/doctest sympy/polys/; SYMPY_GROUND_TYPES=python /sw/bin/python2.6 bin/doctest sympy/polys/; SYMPY_GROUND_TYPES=python python2.5 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=python python2.6 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=sympy /sw/bin/python2.6 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=sympy python2.5 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=sympy python2.6 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=python python2.4 bin/doctest sympy/polys/;
SYMPY_GROUND_TYPES=sympy python2.4 bin/doctest sympy/polys/'

- Presently, there are some test failures from to polys9 in some combinations (c.f. Python 2.4 with SYMPY_GROUND_TYPES=sympy). So if you get a test failure in my branch, please check to see if it
also fails in polys9 first.

- In several places in the code, I have marked a note with "# XXX". These are places where the behavior was unexpected, or I was not sure how to correctly fix something that didn't work. Basically, I need you to go over these, Mateusz, and see what should be done. You can add
comments to github if that is easier.

- Except in a few places such as some of the user functions, I didn't add any more documentation, just doctests. So there is still more work that can be done in the way of polynomial documentation.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to