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

Skip to content

Commit 35a1b69

Browse files
committed
Merge pull request #2367 from mdboom/fix-failing-tests
Fix a number of long-failing tests.
2 parents ab829f2 + f616ec8 commit 35a1b69

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,7 @@ def rcdefaults():
10481048
the rc file, but mpl's internal params. See rc_file_defaults for
10491049
reloading the default params from the rc file
10501050
"""
1051+
rcParams.clear()
10511052
rcParams.update(rcParamsDefault)
10521053

10531054

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ def test_use14corefonts():
1212
rcParams['font.family'] = 'sans-serif'
1313
rcParams['font.size'] = 8
1414
rcParams['font.sans-serif'] = ['Helvetica']
15+
rcParams['pdf.compression'] = 0
1516

1617
title = u'Test PDF backend with option use14corefonts=True'
1718

1819
text = u'''A three-line text positioned just above a blue line
19-
and containing some French characters and the euro symbol:
20-
"Merci pépé pour les 10 €"'''
20+
and containing some French characters and the euro symbol:
21+
"Merci pépé pour les 10 €"'''
2122

2223
plt.figure()
2324
plt.title(title)

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from matplotlib import rcParams, rcParamsDefault
1+
from matplotlib import rcParams
22
from matplotlib.testing.decorators import image_comparison
33
import matplotlib.pyplot as plt
44
import matplotlib.path as mpath
@@ -10,8 +10,6 @@
1010
savefig_kwarg=dict(bbox_inches='tight'), tol=15)
1111
def test_bbox_inches_tight():
1212
"Test that a figure saved using bbox_inches'tight' is clipped right"
13-
rcParams.update(rcParamsDefault)
14-
1513
data = [[ 66386, 174296, 75131, 577908, 32015],
1614
[ 58230, 381139, 78045, 99308, 160454],
1715
[ 89135, 80552, 152558, 497981, 603535],

lib/matplotlib/tests/test_colorbar.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import matplotlib
44
from matplotlib.testing.decorators import image_comparison, knownfailureif
55
import matplotlib.pyplot as plt
6-
from matplotlib import rcParams, rcParamsDefault
6+
from matplotlib import rcParams
77
from matplotlib.colors import BoundaryNorm
88
from matplotlib.cm import get_cmap
99
from matplotlib.colorbar import ColorbarBase
@@ -98,8 +98,6 @@ def _colorbar_extension_length(spacing):
9898
extensions=['png'])
9999
def test_colorbar_extension_shape():
100100
'''Test rectangular colorbar extensions.'''
101-
# Use default params so matplotlibrc doesn't cause the test to fail.
102-
rcParams.update(rcParamsDefault)
103101
# Create figures for uniform and proportionally spaced colorbars.
104102
fig1 = _colorbar_extension_shape('uniform')
105103
fig2 = _colorbar_extension_shape('proportional')
@@ -110,8 +108,6 @@ def test_colorbar_extension_shape():
110108
extensions=['png'])
111109
def test_colorbar_extension_length():
112110
'''Test variable length colorbar extensions.'''
113-
# Use default params so matplotlibrc doesn't cause the test to fail.
114-
rcParams.update(rcParamsDefault)
115111
# Create figures for uniform and proportionally spaced colorbars.
116112
fig1 = _colorbar_extension_length('uniform')
117113
fig2 = _colorbar_extension_length('proportional')

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_image_composite_alpha():
264264
ax.set_ylim([5, 0])
265265

266266

267-
@image_comparison(baseline_images=['rasterize_10dpi'], extensions=['pdf','svg'], tol=1.5e-3, remove_text=True)
267+
@image_comparison(baseline_images=['rasterize_10dpi'], extensions=['pdf','svg'], tol=1.5e-2, remove_text=True)
268268
def test_rasterize_dpi():
269269
# This test should check rasterized rendering with high output resolution.
270270
# It plots a rasterized line and a normal image with implot. So it will catch

0 commit comments

Comments
 (0)