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
"sage -coverage" should not care about functions which are local to other functions/methods #877
Comments
comment:1
To get around this, I took my local function/method and made it a regular one. I then used functools.partial to use it. This allowed my function to be tested like every other one. In the few cases where I had to do this, I ended up liking the functools version better. |
comment:2
#4323 is a duplicate of that ticket. |
Author: John Palmieri |
comment:3
Here is a patch for this. With sage-4.1.1.alpha0, it increases overall coverage from 77.9% to 78.5%. To test: I know that the files steenrod_algebra_element.py and structure/factorization.py have such nested functions, so try 'sage -coverage' on these files, before and after patching. |
Attachment: trac_877-scripts-coverage.patch.gz apply to scripts repository |
comment:4
(Maybe it only goes from 78.0% to 78.5%.) |
comment:5
Looks good to me: BEFORE:
AFTER
The code looks fine and it works fine, so far as I can tell. |
comment:6
quick note just from looking at the patch: i makes more sense to move the re.compile statement before the |
use this version instead |
comment:7
Attachment: trac_877-scripts-coverage2.patch.gz trac_877-scripts-coverage2.patch interchanges the lines that schilly mentions. It also moves another re.compile statement earlier. It also stores the list of nested functions in the list "closures", for possible future use. |
comment:8
This is what I observe regarding John's patch. In Sage 4.1 without the patch
Applying that patch to Sage 4.1:
If I understand John's patch correctly, it doesn't count functions which are local to other functions/methods. This accounts for the reduced number of total functions after applying the patch. Moving on to Sage 4.1.1.alpha0 without the patch:
And with the patch:
Here is the coverage after applying the patch to my merge tree:
Merged |
Merged: Sage 4.1.1.alpha1 |
Reviewer: William Stein, Harald Schilly |
Currently, if you have something like:
then "sage -coverage" will complain that bar() has no docstring or doctests. However, such functions cannot be (directly) doctested, so that warning is invalid. In my opinion, bar() should not be required to have a docstring either.
Component: documentation
Author: John Palmieri
Reviewer: William Stein, Harald Schilly
Merged: Sage 4.1.1.alpha1
Issue created by migration from https://trac.sagemath.org/ticket/877
The text was updated successfully, but these errors were encountered: