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

Silince UnicodeWarnings in tests #3674

Merged
merged 3 commits into from Oct 19, 2014

Conversation

jenshnielsen
Copy link
Member

Fixes warning like the following in the test output:

/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/matplotlib-1.5.x-py2.7-linux-x86_64.egg/matplotlib/text.py:52: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if rotation in ('horizontal', None):

The changes are somewhat stupid and redundant and the only purpose is to fix the warnings.

@@ -3828,9 +3828,9 @@ def __init__(self, dataset, bw_method=None):

if bw_method is None:
pass
elif bw_method == 'scott':
Copy link
Member

Choose a reason for hiding this comment

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

I think a better fix would be to move this test below the tests for callable or guard them with not isinstance(bw_method, six.stirng_types).

@tacaswell tacaswell added this to the v1.5.x milestone Oct 18, 2014
Ensure that bw_method is a string before comparing to strings
Ensure that rotation is string before comparing to string and raise ValueError if rotation could not be converted to float
@jenshnielsen
Copy link
Member Author

Good points. I initially did the smallest changes needed but we might as well do this probably. I have implemented your suggestions with a few variations. In addition i added a few unittests to get_rotation

angle = float(rotation)
return angle % 360

except (ValueError, TypeError):
Copy link
Member Author

Choose a reason for hiding this comment

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

float(None) raises a TypeError

tacaswell added a commit that referenced this pull request Oct 19, 2014
ENH : Silince UnicodeWarnings in tests
@tacaswell tacaswell merged commit 78f1942 into matplotlib:master Oct 19, 2014

return angle
Copy link
Member

Choose a reason for hiding this comment

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

Now that I have merged this I noticed that the mod 360 got dropped, was that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, Missed that, Will fix in a new pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants