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
fix argument checks in axis/base.margins #3078
fix argument checks in axis/base.margins #3078
Conversation
If keyword arguments where used, like mentioned in the documentation, the code would fail as if more than two parameters where given (since len(args) would be 0 -> != 1/2)
@@ -3109,6 +3109,25 @@ def test_pie_ccw_true(): | |||
# Set aspect ratio to be equal so that pie is drawn as a circle. | |||
plt.axis('equal') | |||
|
|||
@image_comparison(baseline_images=['margins_1', 'margins_1_05_arg', 'margins_1_05_kwarg'], extensions=['png']) |
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.
We don't need to create images for these tests - the actual testing is being done in the assertions. As a result, we should just be able to remove this decorator, and replace it with the cleanup one.
You are right, it seems I was a little bit too eager there^^, fixed |
@@ -3109,6 +3109,24 @@ def test_pie_ccw_true(): | |||
# Set aspect ratio to be equal so that pie is drawn as a circle. | |||
plt.axis('equal') | |||
|
|||
def test_margins(): |
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.
This needs a @cleanup
to make sure we don't like figures in the tests.
fix argument checks in axis/base.margins
Thanks @andreasWallner! |
I tried this code today when guessing parameter names:
Which should set the axis margins (according to the function docstring) but throws this error
After looking at the code it seems to me that the keyword parameters where simply forgotten in the checks.
This patch fixes this problem and provides test cases for all call variants of margins.
PS: I hope I did not add too many pictures for such a simple test, but I did not find a way to check for the same picture twice (margins_1_05_arg.png & margins_1_05_kwarg.png).