matplotlib.rcParams.update(rcParams)
fig, ax = plt.subplots()
buffers = [
six.moves.StringIO(),
io.StringIO(),
io.BytesIO()]
if use_log:
ax.set_yscale("log")
ax.plot([1, 2], [1, 2])
ax.set_title(u"Déjà vu")
for buffer in buffers:
fig.savefig(buffer, format=format)
values = [x.getvalue() for x in buffers]
if six.PY3:
values = [
values[0].encode("ascii"),
values[1].encode("ascii"),
values[2]]
// Remove comments from the output. This includes things that
// could change from run to run, such as the time.
values = [re.sub(b"%%.*?\n", b"", x) for x in values]
assert values[0] == values[1]
assert values[1] == values[2].replace(b"\r\n", b"\n")
for buffer in buffers:
buffer.close()
def test_patheffects():
with matplotlib.rc_context():
matplotlib.rcParams["path.effects"] = [
patheffects.withStroke(linewidth=4, foreground="w")]
After Change
fig.savefig(b_buf, format=format)
s_val = s_buf.getvalue().encode("ascii")
b_val = b_buf.getvalue()
// Remove comments from the output. This includes things that could
// change from run to run, such as the time.
s_val, b_val = [re.sub(b"%%.*?\n", b"", x) for x in [s_val, b_val]]