Skip to content

Commit 164222a

Browse files
tacaswellmdboom
authored andcommitted
Merge pull request #5307 from mdboom/lower-tolerance
Lower test tolerance
1 parent cc34fb4 commit 164222a

File tree

1,546 files changed

+246817
-298860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,546 files changed

+246817
-298860
lines changed

examples/api/custom_projection_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def __init__(self, round_to=1.0):
294294
self._round_to = round_to
295295

296296
def __call__(self, x, pos=None):
297-
degrees = round(np.degrees(x) / self._round_to) * self._round_to
297+
degrees = np.round(np.degrees(x) / self._round_to) * self._round_to
298298
# \u00b0 : degree symbol
299299
return "%d\u00b0" % degrees
300300

lib/matplotlib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,7 @@ def tk_window_focus():
14441444
'matplotlib.tests.test_contour',
14451445
'matplotlib.tests.test_dates',
14461446
'matplotlib.tests.test_delaunay',
1447+
'matplotlib.tests.test_dviread',
14471448
'matplotlib.tests.test_figure',
14481449
'matplotlib.tests.test_font_manager',
14491450
'matplotlib.tests.test_gridspec',
@@ -1473,6 +1474,7 @@ def tk_window_focus():
14731474
'matplotlib.tests.test_tightlayout',
14741475
'matplotlib.tests.test_transforms',
14751476
'matplotlib.tests.test_triangulation',
1477+
'matplotlib.tests.test_type1font',
14761478
'matplotlib.tests.test_units',
14771479
'matplotlib.tests.test_widgets',
14781480
'matplotlib.tests.test_cycles',

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from matplotlib.externals import six
55
from matplotlib.externals.six.moves import xrange
66

7+
from collections import OrderedDict
78
import itertools
89
import warnings
910
import math
@@ -903,11 +904,11 @@ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
903904
Intended to be overridden by new projection types.
904905
905906
"""
906-
return {
907-
'left': mspines.Spine.linear_spine(self, 'left'),
908-
'right': mspines.Spine.linear_spine(self, 'right'),
909-
'bottom': mspines.Spine.linear_spine(self, 'bottom'),
910-
'top': mspines.Spine.linear_spine(self, 'top'), }
907+
return OrderedDict([
908+
('left', mspines.Spine.linear_spine(self, 'left')),
909+
('right', mspines.Spine.linear_spine(self, 'right')),
910+
('bottom', mspines.Spine.linear_spine(self, 'bottom')),
911+
('top', mspines.Spine.linear_spine(self, 'top'))])
911912

912913
def cla(self):
913914
"""Clear the current axes."""
@@ -2341,8 +2342,8 @@ def draw(self, renderer=None, inframe=False):
23412342
for z, im in zorder_images]
23422343

23432344
l, b, r, t = self.bbox.extents
2344-
width = int(mag * ((round(r) + 0.5) - (round(l) - 0.5)))
2345-
height = int(mag * ((round(t) + 0.5) - (round(b) - 0.5)))
2345+
width = int(mag * ((np.round(r) + 0.5) - (np.round(l) - 0.5)))
2346+
height = int(mag * ((np.round(t) + 0.5) - (np.round(b) - 0.5)))
23462347
im = mimage.from_images(height,
23472348
width,
23482349
ims)

lib/matplotlib/backends/backend_agg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
175175

176176
xd = descent * sin(radians(angle))
177177
yd = descent * cos(radians(angle))
178-
x = round(x + ox + xd)
179-
y = round(y - oy + yd)
178+
x = np.round(x + ox + xd)
179+
y = np.round(y - oy + yd)
180180
self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
181181

182182
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):

lib/matplotlib/backends/backend_cairo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def set_clip_rectangle(self, rectangle):
359359
if not rectangle: return
360360
x,y,w,h = rectangle.bounds
361361
# pixel-aligned clip-regions are faster
362-
x,y,w,h = round(x), round(y), round(w), round(h)
362+
x,y,w,h = np.round(x), np.round(y), np.round(w), np.round(h)
363363
ctx = self.ctx
364364
ctx.new_path()
365365
ctx.rectangle (x, self.renderer.height - h - y, w, h)

lib/matplotlib/backends/backend_gdk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
9191
for polygon in polygons:
9292
# draw_polygon won't take an arbitrary sequence -- it must be a list
9393
# of tuples
94-
polygon = [(int(round(x)), int(round(y))) for x, y in polygon]
94+
polygon = [(int(np.round(x)), int(np.round(y))) for x, y in polygon]
9595
if rgbFace is not None:
9696
saveColor = gc.gdkGC.foreground
9797
gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace)
@@ -281,7 +281,7 @@ def _get_pango_layout(self, s, prop):
281281
return value
282282

283283
size = prop.get_size_in_points() * self.dpi / 96.0
284-
size = round(size)
284+
size = np.round(size)
285285

286286
font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)
287287
font = pango.FontDescription(font_str)
@@ -387,7 +387,7 @@ def set_dashes(self, dash_offset, dash_list):
387387
self.gdkGC.line_style = gdk.LINE_SOLID
388388
else:
389389
pixels = self.renderer.points_to_pixels(np.asarray(dash_list))
390-
dl = [max(1, int(round(val))) for val in pixels]
390+
dl = [max(1, int(np.round(val))) for val in pixels]
391391
self.gdkGC.set_dashes(dash_offset, dl)
392392
self.gdkGC.line_style = gdk.LINE_ON_OFF_DASH
393393

@@ -413,7 +413,7 @@ def set_linewidth(self, w):
413413
self.gdkGC.line_width = 0
414414
else:
415415
pixels = self.renderer.points_to_pixels(w)
416-
self.gdkGC.line_width = max(1, int(round(pixels)))
416+
self.gdkGC.line_width = max(1, int(np.round(pixels)))
417417

418418

419419
def new_figure_manager(num, *args, **kwargs):

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ def cvt(length, upe=font.units_per_EM, nearest=True):
824824
"Convert font coordinates to PDF glyph coordinates"
825825
value = length / upe * 1000
826826
if nearest:
827-
return round(value)
827+
return np.round(value)
828828
# Perhaps best to round away from zero for bounding
829829
# boxes and the like
830830
if value < 0:

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,6 @@ def print_figure_impl():
11711171
print("%s translate"%_nums_to_str(xo, yo), file=fh)
11721172
if rotation: print("%d rotate"%rotation, file=fh)
11731173
print("%s clipbox"%_nums_to_str(width*72, height*72, 0, 0), file=fh)
1174-
# Disable any sort of miter limit
1175-
print("%s setmiterlimit" % 100000, file=fh)
11761174

11771175
# write the figure
11781176
content = self._pswriter.getvalue()
@@ -1322,8 +1320,6 @@ def write(self, *kl, **kwargs):
13221320
#print >>fh, "gsave"
13231321
print("%s translate"%_nums_to_str(xo, yo), file=fh)
13241322
print("%s clipbox"%_nums_to_str(width*72, height*72, 0, 0), file=fh)
1325-
# Disable any sort of miter limit
1326-
print("%d setmiterlimit" % 100000, file=fh)
13271323

13281324
# write the figure
13291325
print(self._pswriter.getvalue(), file=fh)

lib/matplotlib/backends/backend_svg.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from matplotlib.externals.six import unichr
77

88
import os, base64, tempfile, gzip, io, sys, codecs, re
9+
from collections import OrderedDict
910

1011
import numpy as np
1112

@@ -271,15 +272,15 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
271272
assert basename is not None
272273
self.basename = basename
273274
self._imaged = {}
274-
self._clipd = {}
275+
self._clipd = OrderedDict()
275276
self._char_defs = {}
276277
self._markers = {}
277278
self._path_collection_id = 0
278279
self._imaged = {}
279-
self._hatchd = {}
280+
self._hatchd = OrderedDict()
280281
self._has_gouraud = False
281282
self._n_gradients = 0
282-
self._fonts = {}
283+
self._fonts = OrderedDict()
283284
self.mathtext_parser = MathTextParser('SVG')
284285

285286
RendererBase.__init__(self)
@@ -306,10 +307,7 @@ def _write_default_style(self):
306307
writer = self.writer
307308
default_style = generate_css({
308309
'stroke-linejoin': 'round',
309-
'stroke-linecap': 'butt',
310-
# Disable the miter limit. 100000 seems to be close to
311-
# the maximum that renderers support before breaking.
312-
'stroke-miterlimit': '100000'})
310+
'stroke-linecap': 'butt'})
313311
writer.start('defs')
314312
writer.start('style', type='text/css')
315313
writer.data('*{%s}\n' % default_style)
@@ -1104,7 +1102,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11041102

11051103
# Sort the characters by font, and output one tspan for
11061104
# each
1107-
spans = {}
1105+
spans = OrderedDict()
11081106
for font, fontsize, thetext, new_x, new_y, metrics in svg_glyphs:
11091107
style = generate_css({
11101108
'font-size': short_float_fmt(fontsize) + 'px',
@@ -1120,7 +1118,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11201118
fontset = self._fonts.setdefault(font.fname, set())
11211119
fontset.add(thetext)
11221120

1123-
for style, chars in list(six.iteritems(spans)):
1121+
for style, chars in six.iteritems(spans):
11241122
chars.sort()
11251123

11261124
same_y = True

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def __init__(self, t, fmt, tz=None):
609609

610610
def __call__(self, x, pos=0):
611611
'Return the label for time *x* at position *pos*'
612-
ind = int(round(x))
612+
ind = int(np.round(x))
613613
if ind >= len(self.t) or ind <= 0:
614614
return ''
615615

0 commit comments

Comments
 (0)