10000 Close temp file following rec2csv_bad_shape test to avoid warning in … · matplotlib/matplotlib@8ee4c35 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ee4c35

Browse files
committed
Close temp file following rec2csv_bad_shape test to avoid warning in python3
< 8000 div class="d-flex flex-items-center flex-wrap fgColor-muted gap-1">
1 parent a9adc68 commit 8ee4c35

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/matplotlib/tests/test_mlab.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ def test_recarray_csv_roundtrip():
2727

2828
@raises(ValueError)
2929
def test_rec2csv_bad_shape():
30-
bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
31-
fd = tempfile.TemporaryFile(suffix='csv')
32-
33-
# the bad recarray should trigger a ValueError for having ndim > 1.
34-
mlab.rec2csv(bad,fd)
30+
try:
31+
bad = np.recarray((99,4),[('x',np.float),('y',np.float)])
32+
fd = tempfile.TemporaryFile(suffix='csv')
33+
34+
# the bad recarray should trigger a ValueError for having ndim > 1.
35+
mlab.rec2csv(bad,fd)
36+
finally:
37+
fd.close()
3538

3639
def test_prctile():
3740
# test odd lengths

0 commit comments

Comments
 (0)
0