Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1976db5

Browse files
committed
unicode test passes
1 parent cda758d commit 1976db5

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def validate_backend(s):
144144
else:
145145
return _validate_standard_backends(s)
146146

147+
147148
validate_qt4 = ValidateInStrings('backend.qt4', ['PyQt4', 'PySide'])
148149

149150

@@ -264,13 +265,14 @@ def validate_string(s):
264265
assert isinstance(s, basestring)
265266
return s.strip("'").strip()
266267

268+
267269
def validate_stringlist(s):
268270
'return a list'
269271
if isinstance(s, basestring):
270272
return [validate_string(v) for v in s.split(',')]
271273
else :
272274
assert type(s) in [list, tuple]
273-
return [str(v) for v in s]
275+
return [validate_string(v) for v in s]
274276

275277

276278
validate_orientation = ValidateInStrings(

lib/matplotlib/tests/test_rcsetup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ def test_template():
2525
assert mpl.rcParams[k] == v[0]
2626

2727
def test_unicode():
28-
# unicode formatted valid strings should validate.
28+
# unicode formatted valid strings should validate successfully
2929
for k, v in mpl.rcsetup.defaultParams.iteritems():
30-
if v[0] != v[1](unicode(v[0])):
31-
print "Expected : ", v[0]
32-
print "Actual : ", v[1](unicode(v[0]))
33-
assert v[0] == v[1](unicode(v[0]))
30+
if k not in deprecated:
31+
if isinstance(v[0], basestring):
32+
u = v[1](unicode(v[0]))
33+
if u not in [v[0], v[0].lower()] :
34+
print "Expected : ", v[0]
35+
print "Actual : ", u
36+
assert u in [v[0], v[0].lower()]
3437

3538

3639
if __name__ == '__main__':

0 commit comments

Comments
 (0)