Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix CirclePolygon __str__ + adding tests #11212

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

Merged

Conversation

ImportanceOfBeingErnest
Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest commented May 9, 2018

Bug report

Previously, the following

from matplotlib.patches import CirclePolygon
circle = CirclePolygon((1, 2), radius = 1)
print(circle)

would fail with a

AttributeError: 'CirclePolygon' object has no attribute 'center'

PR Summary

This PR

  • fixes the above error by replacing the __str__
  • adds a test for this
  • Replaces a couple of other __str__ representations for patches and adds tests for them as well, such that by now all patches are tested, except for Arrow and FancyArrow because it seems they are not really needed anyways.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant

@ImportanceOfBeingErnest ImportanceOfBeingErnest force-pushed the fix-circlepolygon-str branch 4 times, most recently from 317bcc2 to 001443b Compare May 9, 2018 23:53
@ImportanceOfBeingErnest
Copy link
Member Author

Let's hope for the test to mysteriously fix itself; the error seems pretty random and uncorrelated to anything in this PR.

@tacaswell tacaswell added this to the v3.0 milestone May 10, 2018
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Still would like to have the requested changes concerning spaces.

assert str(p)[:27] == "FancyArrowPatch(Path(array("

p = mpatches.FancyArrowPatch((1, 2), (3, 4))
assert str(p) == "FancyArrowPatch(1,2->3,4)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add spaces.

assert str(p) == "ConnectionPatch((1,2),(3,4))"

s = mpatches.Shadow(p, 1, 1)
assert str(s) == "Shadow(ConnectionPatch((1,2),(3,4)))"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add spaces.

@ImportanceOfBeingErnest
Copy link
Member Author

OK, done.

@jklymak jklymak merged commit d045031 into matplotlib:master May 10, 2018
@ImportanceOfBeingErnest ImportanceOfBeingErnest deleted the fix-circlepolygon-str branch May 10, 2018 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.