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

Fixup original unit test, set up tests to run in GitHub Actions #66

Merged
merged 3 commits into from
Jun 3, 2023

Conversation

mfisher87
Copy link
Collaborator

Merge #65 first. Not sure what the best practice for opening chained/dependent PRs from a fork is. I'll just rebase once #65 is merged.

@mfisher87 mfisher87 requested a review from stefanv June 2, 2023 01:11
colors = [
# TODO: Should we divide by 255 here instead of 256? The tests pass with a
# lower value for `err` if we do.
[int(c[i : i + 2], 16) / 256 for i in range(0, len(c), 2)]
Copy link
Collaborator Author

@mfisher87 mfisher87 Jun 2, 2023

Choose a reason for hiding this comment

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

The maximum value of int(c[i : i + 2], 16) here (int('ff', 16)) is 255, so dividing by 256 is slightly compressing the resulting values towards 0 instead of producing a true 0-1 scale. Is this right?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds right!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, want to be 100% sure I understand: Does dividing by 255 sound right to you, or 256?

Copy link
Collaborator Author

@mfisher87 mfisher87 Jun 3, 2023

Choose a reason for hiding this comment

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

@stefanv
Copy link
Contributor

stefanv commented Jun 2, 2023

Does this need to be rebased, now that I merged #65?

@mfisher87
Copy link
Collaborator Author

mfisher87 commented Jun 2, 2023 via email

The unit test appears to have fallen out of sync with the code long ago
(e.g. it seems to previously expect the values from `get_sRGB` to range
from 0-255). I did my best to restore it, but at this point I'm not 100%
sure why the colormaps only match approximately after applying these
fixes.
@mfisher87
Copy link
Collaborator Author

@stefanv rebased and ready to go

@mfisher87 mfisher87 mentioned this pull request Jun 2, 2023
colors = [
# TODO: Should we divide by 255 here instead of 256? The tests pass with a
# lower value for `err` if we do.
[int(c[i : i + 2], 16) / 256 for i in range(0, len(c), 2)]
Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds right!

@mfisher87 mfisher87 merged commit 6b35100 into matplotlib:main Jun 3, 2023
@mfisher87 mfisher87 deleted the unit-test branch June 3, 2023 01:02
@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.

2 participants