Skip to content

Commit 3e60527

Browse files
committed
Test based on #4147
1 parent 4871e1f commit 3e60527

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/matplotlib/tests/test_mathtext.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
import six
55

6+
import io
7+
68
import numpy as np
79
import matplotlib
8-
from matplotlib.testing.decorators import image_comparison, knownfailureif
10+
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
911
import matplotlib.pyplot as plt
1012
from matplotlib import mathtext
1113

@@ -210,6 +212,22 @@ def test_mathtext_exceptions():
210212
else:
211213
assert False, "Expected '%s', but didn't get it" % msg
212214

215+
@cleanup
216+
def test_single_minus_sign():
217+
plt.figure(figsize=(0.3, 0.3))
218+
plt.text(0.5, 0.5, '$-$')
219+
for spine in plt.gca().spines.values():
220+
spine.set_visible(False)
221+
plt.gca().set_xticks([])
222+
plt.gca().set_yticks([])
223+
224+
buff = io.BytesIO()
225+
plt.savefig(buff, format="rgba", dpi=1000)
226+
array = np.fromstring(buff.getvalue(), dtype=np.uint8)
227+
228+
# If this fails, it would be all white
229+
assert not np.all(array == 0xff)
230+
213231

214232
if __name__ == '__main__':
215233
import nose

0 commit comments

Comments
 (0)