-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
added check for invalid range in contour_plot and derivatives #35113
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #35113 +/- ##
===========================================
- Coverage 88.59% 88.59% -0.01%
===========================================
Files 2140 2140
Lines 396998 397004 +6
===========================================
- Hits 351740 351739 -1
- Misses 45258 45265 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@tobiasdiez Would you approve the workflows if you have the permission? |
src/sage/plot/misc.py
Outdated
@@ -139,6 +139,13 @@ def setup_for_eval_on_grid(funcs, | |||
else: | |||
vars, free_vars = unify_arguments(funcs) | |||
|
|||
#check for invalid range entered by user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a space # check
I would write # check for valid range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look into the Build & Test check. There are lots of failed doctests. It seems that
ranges[1]
may not exist.
Solved this. Some functions take range input differently, so nested my if condition inside another which checks if:
len(ranges) > 1
Haven't pushed it yet due to the issue mentioned in the comment below.
Look into the Build & Test check. There are lots of failed doctests. It seems that |
I think I found the error. One of the examples in the doctest is the following: Lines 107 to 111 in 05329f6
Which has the range in the wrong format as in example 1: xmin(=1) > xmax(=-1) and in example2 : ymin(=1) > ymax(=-1) which is against the definition of range : Lines 34 to 36 in 05329f6
Should I change the doctest example in this case and make it go from -1 to 1? This test is failling the code edit as this is the very error it aims to catch. |
It seems we could just swap the two values to fix the error, and use the doctests to test this conveniency. |
Nice idea! |
You can just fix the minor changes in the return values in the doctests. That is,
|
Remove unnecessary parentheses in the condition of |
Upon making this change, all tests are passed for misc.py
giving me:
Is that enough or should I now run:
? |
…ate docstest to account for the same
Normally, you don't need to because workflows for checking the branch should be run by now. But, as you are first-time contributor, it seems that running workflows require admin's permission. @tobiasdiez may take care of you. |
Could triage team have the permission to approve to run workflows for first-time (non-member) contributors? |
@kwankyu Unfortunately, we can't change the permissions on a fine-grained level without paying for Github's enterprise level. But I'll approve the run here. |
Thanks. I wonder if we can run a bot approving workflows automatically for PRs with secure(?) branch and with certain label... |
I don't know how we would check that code is secure.... |
We may consider code is basically secure when there's no change in github workflows. Other than that, the reviewer should decide whether to trust the contributor and add a label to signify that. But I don't know the technical side whether github allows such a bot. Logically, it seems, the bot should not be a github workflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@kwankyu Thank you for bearing with all my doubts and walking me through this PR/issue. Is there anything else I need to do for this particular PR/issue? Thank you again for taking the time! |
Once you get "positive review", you are all set. Anyway, for this PR, if you are willing, please make the comment
Yes (but no for this PR). But don't mind that. |
src/sage/plot/misc.py
Outdated
@@ -139,6 +139,14 @@ def setup_for_eval_on_grid(funcs, | |||
else: | |||
vars, free_vars = unify_arguments(funcs) | |||
|
|||
# check for invalid range entered by user (xmin > xmax or ymin > ymax) and swap the values if True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating comment to be shorter.
Thank you. Comment updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you.
Removed trailing whitespace in the comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
Documentation preview for this PR is ready! 🎉 |
📚 Description
Solves #35032
Add if condition in misc.py which contour_plot uses to check for invalid range entered by user(xmin > xmax or ymin>ymax)
📝 Checklist