8000 Merge branch 'test_fixes' of https://github.com/CTPUG/matplotlib-py3 … · matplotlib/matplotlib@3fd83a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3fd83a6

Browse files
committed
Merge branch 'test_fixes' of https://github.com/CTPUG/matplotlib-py3 into CTPUG-test_fixes
2 parents 17fafc0 + 2962c8d commit 3fd83a6

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

doc/devel/coding_guide.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ arguments works from within Python::
401401
.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
402402

403403

404+
Running tests by any means other than `matplotlib.test()`
405+
does not load the nose "knownfailureif" (Known failing tests) plugin,
406+
causing known-failing tests to fail for real.
404407

405408
Writing a simple test
406409
---------------------

lib/matplotlib/_mathtext_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""
22
font data tables for truetype and afm computer modern fonts
33
"""
4-
54
# this dict maps symbol names to fontnames, glyphindex. To get the
65
# glyph index from the character code, you have to use get_charmap
6+
from __future__ import print_function
7+
78
"""
89
from matplotlib.ft2font import FT2Font
910
font = FT2Font('/usr/local/share/matplotlib/cmr10.ttf')
@@ -13,7 +14,6 @@
1314
for charcode, glyphind in items:
1415
print charcode, glyphind
1516
"""
16-
from __future__ import print_function
1717

1818
latex_to_bakoma = {
1919
r'\oint' : ('cmex10', 45),

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
platforms, so if a font is installed, it is much more likely to be
2020
found.
2121
"""
22+
from __future__ import print_function
2223

2324
"""
2425
KNOWN ISSUES
@@ -42,7 +43,6 @@
4243
see license/LICENSE_TTFQUERY.
4344
"""
4445

45-
from __future__ import print_function
4646
import os, sys, glob, subprocess, warnings
4747
try:
4848
set

lib/matplotlib/testing/compare.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"""
55
#=======================================================================
66

7-
from __future__ import print_function
7+
from __future__ import division
8+
89
import matplotlib
910
from matplotlib.testing.noseclasses import ImageComparisonFailure
1011
from matplotlib.testing import image_util
@@ -198,11 +199,14 @@ def compare_images( expected, actual, tol, in_decorator=False ):
198199

199200
# compare the resulting image histogram functions
200201
rms = 0
202+
bins = np.arange(257)
201203
for i in xrange(0, 3):
202204
h1p = expectedImage[:,:,i]
203205
h2p = actualImage[:,:,i]
204-
h1h = np.histogram(h1p, bins=256)[0]
205-
h2h = np.histogram(h2p, bins=256)[0]
206+
207+
h1h = np.histogram(h1p, bins=bins)[0]
208+
h2h = np.histogram(h2p, bins=bins)[0]
209+
206210
rms += np.sum(np.power((h1h-h2h), 2))
207211
rms = np.sqrt(rms / (256 * 3))
208212

lib/matplotlib/tests/test_mlab.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ def test_colinear_pca():
1414
def test_recarray_csv_roundtrip():
1515
expected = np.recarray((99,),
1616
[('x',np.float),('y',np.float),('t',np.float)])
17-
expected['x'][0] = 1
18-
expected['y'][1] = 2
19-
expected['t'][2] = 3
20-
fd = tempfile.TemporaryFile(suffix='csv')
17+
# initialising all values: uninitialised memory sometimes produces floats
18+
# that do not round-trip to string and back.
19+
expected['x'] = np.linspace(0,1e-200,99)
20+
expected['y'] = np.linspace(0,1,99)
21+
expected['t'] = np.linspace(0,1e300,99)
22+
fd = tempfile.TemporaryFile(suffix='csv', mode="w+")
2123
mlab.rec2csv(expected,fd)
2224
fd.seek(0)
2325
actual = mlab.csv2rec(fd)

lib/matplotlib/tests/test_simplification.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ def test_noise():
7575
path = transform.transform_path(path)
7676
simplified = list(path.iter_segments(simplify=(800, 600)))
7777

78-
print(len(simplified))
79-
8078
assert len(simplified) == 3884
8179

8280
def test_sine_plus_noise():
@@ -94,8 +92,6 @@ def test_sine_plus_noise():
9492
path = transform.transform_path(path)
9593
simplified = list(path.iter_segments(simplify=(800, 600)))
9694

97-
print(len(simplified))
98-
9995
assert len(simplified) == 876
10096

10197
@image_comparison(baseline_images=['simplify_curve'])
@@ -141,8 +137,6 @@ def test_fft_peaks():
141137
path = transform.transform_path(path)
142138
simplified = list(path.iter_segments(simplify=(800, 600)))
143139

144-
print(len(simplified))
145-
146140
assert len(simplified) == 20
147141

148142
def test_start_with_moveto():
@@ -180,7 +174,6 @@ def test_start_with_moveto():
180174
@raises(OverflowError)
181175
def test_throw_rendering_complexity_exceeded():
182176
rcParams['path.simplify'] = False
183-
184177
xx = np.arange(200000)
185178
yy = np.random.rand(200000)
186179
yy[1000] = np.nan
@@ -189,9 +182,7 @@ def test_throw_rendering_complexity_exceeded():
189182
ax.plot(xx, yy)
190183
try:
191184
fig.savefig(io.StringIO())
192-
except e:
193-
raise e
194-
else:
185+
finally:
195186
rcParams['path.simplify'] = True
196187

197188
@image_comparison(baseline_images=['clipper_edge'])

0 commit comments

Comments
 (0)
0