MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_bbox

Function test_bbox

lib/matplotlib/tests/test_backend_ps.py:164–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162
163
164def test_bbox():
165 fig, ax = plt.subplots()
166 with io.BytesIO() as buf:
167 fig.savefig(buf, format='eps')
168 buf = buf.getvalue()
169
170 bb = re.search(b'^%%BoundingBox: (.+) (.+) (.+) (.+)$', buf, re.MULTILINE)
171 assert bb
172 hibb = re.search(b'^%%HiResBoundingBox: (.+) (.+) (.+) (.+)$', buf,
173 re.MULTILINE)
174 assert hibb
175
176 for i in range(1, 5):
177 # BoundingBox must use integers, and be ceil/floor of the hi res.
178 assert b'.' not in bb.group(i)
179 assert int(bb.group(i)) == pytest.approx(float(hibb.group(i)), 1)
180
181
182@needs_usetex

Callers

nothing calls this directly

Calls 4

searchMethod · 0.80
groupMethod · 0.80
subplotsMethod · 0.45
savefigMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…