matplotlib/matplotlib — pull request #2193 by katyhuff (2013-07-02 02:05:45+00:00)
Title: Rc fixes

This pull request achieves approximately two things.

1. One is that it mostly fixes issue #1713. It doesn't quite teach matplotlib to read in special encodings in the matplotlibrc (which would be lovely, but I didn't have time just now). However, it does teach matplotlib to treat unicode strings identically to bytestrings, (which I've been told may help with python 3 compatibility?).

2. The second is that it creates some tests that query a few things about rcsetup. These tests including a test for the above unicode behavior and a test querying whether an uncommented version of the matplotlibrc.template currently provided actually validates and agrees with the default parameters in rcsetup (hint, it was close before, but now it's right on).

Changes in rcsetup.py :

1. ```type("astring") is str``` doesn't work for unicode, but ```isinstance("astring", basestring)``` works for both bytestrings and unicode. (http://www.evanjones.ca/python-utf8.html). So, I exchanged instances of the former with the latter.

1. My test found that sometimes the apostrophes weren't properly stripped from the matplotlibrc file and I was getting errors indicating that "'param'" did not equal "param" for various parameters. So, I made a validate_string function that strips those things too.

1. My test noticed that hinting should accept "True" as an option, so I added that to the validate hinting function.

1. The test found that deprecate_svg_paths doesn't actually return the variable after issuing the warning. The other deprecated functions do return the variable, so added that.

1. A few font styles were present in matplotlibrc.template that werent in the rcsetup defaults, so I added those.

1. Matplotlibrc.template uses full color names, but the defaults in rcsetup use the letter abbreviations. That's cool, but since they should probably be identical and the matplotlibrc.template file should use words for readability, I changed the rcsetup to use "black" instead of "k," for example.

1. The test noticed a merged set of font names due to a missing comma (there is no such font as "ImpactWestern"!)

1. Some of the defaults were provided as single strings or tuples, when they are really list objects (their validators return lists).

Changes in matplotlibrc.template :

1. When in doubt about results from the tests, I mostly changed the matplotlibrc.template to conform to rcsetup.py. This included a few bugs, but mostly just slight adjustments to the expected parameter.

1. I also made some changes to the spacing so that comments would line up nicer in one section.

New test files :

1. test_rcsetup.rc is a *copy* of the matplotlibrc.template .

1. test_rcsetup.py adds some tests, discussed above.