8000 Clean up test_chunksize_fails() · matplotlib/matplotlib@a10b4c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a10b4c5

Browse files
committed
Clean up test_chunksize_fails()
1 parent f5ffdb8 commit a10b4c5

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

lib/matplotlib/tests/test_agg.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,50 +286,46 @@ def test_chunksize_fails():
286286
w = 5*dpi
287287
h = 6*dpi
288288

289-
# just fit in the width
289+
# make a Path that spans the whole w-h rectangle
290290
x = np.linspace(0, w, N)
291-
# and go top-to-bottom
292291
y = np.ones(N) * h
293292
y[::2] = 0
293+
path = Path(np.vstack((x, y)).T)
294+
# effectively disable path simplification (but leaving it "on")
295+
path.simplify_threshold = 0
294296

295-
idt = IdentityTransform()
296-
# make a renderer
297+
# setup the minimal GraphicsContext to draw a Path
297298
ra = RendererAgg(w, h, dpi)
298-
# setup the minimal gc to draw a line
299299
gc = ra.new_gc()
300300
gc.set_linewidth(1)
301301
gc.set_foreground('r')
302-
# make a Path
303-
p = Path(np.vstack((x, y)).T)
304-
# effectively disable path simplification (but leaving it "on")
305-
p.simplify_threshold = 0
306302

307303
gc.set_hatch('/')
308-
with pytest.raises(OverflowError, match='hatched path'):
309-
ra.draw_path(gc, p, idt)
304+
with pytest.raises(OverflowError, match='can not split hatched path'):
305+
ra.draw_path(gc, path, IdentityTransform())
310306
gc.set_hatch(None)
311307

312-
with pytest.raises(OverflowError, match='filled path'):
313-
ra.draw_path(gc, p, idt, (1, 0, 0))
308+
with pytest.raises(OverflowError, match='can not split filled path'):
309+
ra.draw_path(gc, path, IdentityTransform(), (1, 0, 0))
314310

315311
# Set to zero to disable, currently defaults to 0, but let's be sure.
316312
with rc_context({'agg.path.chunksize': 0}):
317313
with pytest.raises(OverflowError, match='Please set'):
318-
ra.draw_path(gc, p, idt)
314+
ra.draw_path(gc, path, IdentityTransform())
319315

320316
# Set big enough that we do not try to chunk.
321317
with rc_context({'agg.path.chunksize': 1_000_000}):
322318
with pytest.raises(OverflowError, match='Please reduce'):
323-
ra.draw_path(gc, p, idt)
319+
ra.draw_path(gc, path, IdentityTransform())
324320

325321
# Small enough we will try to chunk, but big enough we will fail to render.
326322
with rc_context({'agg.path.chunksize': 90_000}):
327323
with pytest.raises(OverflowError, match='Please reduce'):
328-
ra.draw_path(gc, p, idt)
324+
ra.draw_path(gc, path, IdentityTransform())
329325

330-
p.should_simplify = False
326+
path.should_simplify = False
331327
with pytest.raises(OverflowError, match="should_simplify is False"):
332-
ra.draw_path(gc, p, idt)
328+
ra.draw_path(gc, path, IdentityTransform())
333329

334330

335331
def test_non_tuple_rgbaface():

0 commit comments

Comments
 (0)
0