|
6 | 6 |
|
7 | 7 | import numpy as np |
8 | 8 |
|
| 9 | +from nibabel.tmpdirs import InTemporaryDirectory |
| 10 | + |
9 | 11 | from ... import load |
10 | 12 | from .. import (GiftiImage, GiftiDataArray, GiftiLabel, |
11 | 13 | GiftiLabelTable, GiftiMetaData, GiftiNVPairs, |
@@ -40,7 +42,7 @@ def test_agg_data(): |
40 | 42 |
|
41 | 43 | assert_array_equal(surf_gii_img.agg_data('pointset'), point_data) |
42 | 44 | assert_array_equal(surf_gii_img.agg_data('triangle'), triangle_data) |
43 | | - assert_array_equal(func_gii_img.agg_data('time series'), func_data) |
| 45 | + assert_array_equal(func_gii_img.agg_data('time series'), func_data) |
44 | 46 | assert_array_equal(shape_gii_img.agg_data('shape'), shape_data) |
45 | 47 |
|
46 | 48 | assert surf_gii_img.agg_data('time series') == () |
@@ -443,3 +445,11 @@ def test_darray_dtype_coercion_failures(): |
443 | 445 | da_copy = gii_copy.darrays[0] |
444 | 446 | assert np.dtype(da_copy.data.dtype) == np.dtype(darray_dtype) |
445 | 447 | assert_array_equal(da_copy.data, da.data) |
| 448 | + |
| 449 | + |
| 450 | +def test_gifti_file_close(): |
| 451 | + gii = load(test_data('gifti', 'ascii.gii')) |
| 452 | + with pytest.WarningsRecorder() as record: |
| 453 | + with InTemporaryDirectory(): |
| 454 | + gii.to_filename('test.gii') |
| 455 | + assert not any(isinstance(r.message, ResourceWarning) for r in record.list) |
0 commit comments