Skip to content

TST: Add tests for Affine2D - #27511

Merged
oscargus merged 1 commit into
matplotlib:mainfrom
QuLogic:affine-tests
Dec 14, 2023
Merged

oscargus merged 1 commit into
matplotlib:mainfrom
QuLogic:affine-tests

Conversation

@QuLogic

@QuLogic QuLogic commented Dec 13, 2023 •

Copy link
Copy Markdown
Member

PR summary

This is implicitly tested via all plots and layout. However, this makes it difficult to work on the transform stack directly (cf #22191), which these tests rectify.

I deliberately chose points/angles that were easy to work out in my head, so hopefully there are not any edge cases that were missed here. (Except for skew, for which I don't have an inherent idea of what that transform looks like, so I admit to just copy-pasting the existing output there.)

PR checklist

Comment thread lib/matplotlib/tests/test_transforms.py Outdated
Comment on lines +104 to +105
trans_rad = Affine2D().skew(np.pi / 12, np.pi / 12)
trans_deg = Affine2D().skew_deg(15, 15)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thinking a bit more, this should probably skew different angles for x and y.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Talked with @ksunden and decided to use a couple of back-calculated values that produce a reasonable set of results.

This is implicitly tested via all plots and layout. However, this makes
it difficult to work on the transform stack directly, which these tests
rectify.

@oscargus oscargus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One may consider using match for the error tests, but that was not present in the earlier code anyway, so no point in requiring it here.

@oscargus
oscargus merged commit e90058d into matplotlib:main Dec 14, 2023
@QuLogic
QuLogic deleted the affine-tests branch December 14, 2023 08:20
@QuLogic QuLogic added this to the v3.9.0 milestone Dec 14, 2023
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.

3 participants