Skip to content
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

Unit test refactor #67

Merged
merged 1 commit into from
Jun 3, 2023
Merged

Conversation

mfisher87
Copy link
Collaborator

@mfisher87 mfisher87 commented Jun 2, 2023

Make the unit tests a bit easier to understand by splitting the attribute tests from the colormap value tests. Use expected/actual terminology to (IMO) improve test readability.

Should be rebased after #66 is merged

Still thinking about: how can these chained/dependent PRs be made easier to manage?

)
return act

def test_editor_loads_jscm_parameters_match(self, colormap_file):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This gives us a set of 3 passing tests which just check attributes are as expected, and 3 xfail tests which check actual values loaded from a jscm file.

@@ -18,52 +18,74 @@ def approxeq(x, y, *, err=0.0001):
"viscm/examples/sample_diverging_continuous.jscm",
],
)
@pytest.mark.xfail(reason="Test very old; intent unclear")
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a test that ensures that the editor can load a .jscm data file and interpret its values correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

The refactoring looks good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This looks like a test that ensures that the editor can load a .jscm data file and interpret its values correctly.

Got that; I'm referring to this assertion here when I say "intent unclear":

assert actual_colors[i][z] == np.rint(expected_colors[i][z] / 256)

Right now I'm not sure why this was ever working :)

@stefanv stefanv merged commit 6215af7 into matplotlib:main Jun 3, 2023
5 checks passed
@mfisher87 mfisher87 deleted the unit-test-refactor branch June 3, 2023 04:08
@mfisher87 mfisher87 added this to the v0.10 milestone Jun 11, 2023
@mfisher87 mfisher87 added the ci label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants