Closed
Description
import matplotlib
matplotlib.use('svg')
from matplotlib.testing.decorators import cleanup
def make_svg(filename, usetex):
from matplotlib import rc
from matplotlib.figure import Figure
from matplotlib.backends.backend_svg import FigureCanvasSVG
rc('text', usetex=usetex)
fig = Figure()
ax = fig.add_subplot(111)
FigureCanvasSVG(fig).print_svg(filename)
@cleanup
def make_svg_with_cleanup(filename, usetex):
make_svg(filename, usetex)
def do_test(cleanup, usetex):
import io
stream = io.BytesIO()
if cleanup:
make_svg_with_cleanup(stream, usetex)
else:
make_svg(stream, usetex)
assert not stream.closed
return stream.getvalue()
do_test(cleanup=False, usetex=True)
do_test(cleanup=True, usetex=True)
do_test(cleanup=False, usetex=False)
do_test(cleanup=True, usetex=False)
Bunch of seek(0)
calls on BytesIO
objects in different tests can be related to this bug.
Metadata
Metadata
Assignees
Labels
No labels