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

Fix 1825 #1831

Merged
merged 6 commits into from Feb 24, 2016
Merged

Fix 1825 #1831

merged 6 commits into from Feb 24, 2016

Conversation

@chaosphere2112
Copy link
Contributor

@chaosphere2112 chaosphere2112 commented Feb 16, 2016

Fixes the issue discovered by Ram on the mailing list, where you could not set the missing color for a graphics method using a color's name. Adds a test to cover that usecase.

@chaosphere2112
Copy link
Contributor Author

@chaosphere2112 chaosphere2112 commented Feb 16, 2016

try:
# Is it a colormap index?
return colormap.index[color]
except ValueError:
Copy link
Contributor

@aashish24 aashish24 Feb 17, 2016

should be a IndexError?

Copy link
Contributor Author

@chaosphere2112 chaosphere2112 Feb 17, 2016

Nope, it's a ValueError. We implement __setitem__ and __getitem__ on the colormap object, and raise a ValueError if the key isn't a number between 0 and 256.

Copy link
Contributor

@aashish24 aashish24 Feb 17, 2016

Interesting, I would expect a IndexError from this code but your code looks go to me.

@aashish24
Copy link
Contributor

@aashish24 aashish24 commented Feb 17, 2016

LGTM except that I have question on best practices for try and except.

+2

doutriaux1 added a commit that referenced this issue Feb 24, 2016
@doutriaux1 doutriaux1 merged commit a6757f5 into master Feb 24, 2016
5 of 6 checks passed
@doutriaux1 doutriaux1 deleted the fix_1825 branch Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants