Skip to content

Commit ceb6f72

Browse files
author
Ben Cipollini
committed
TST: Add parse_gifti_fast deprecation tests (and fix old deprecation tests)
1 parent 853508e commit ceb6f72

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

nibabel/gifti/tests/test_parse_gifti_fast.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import nibabel.gifti as gi
1818
from nibabel.gifti.util import gifti_endian_codes
19+
from nibabel.gifti.parse_gifti_fast import Outputter, parse_gifti_file
1920
from nibabel.loadsave import load, save
2021
from nibabel.nifti1 import xform_codes
2122
from nibabel.tmpdirs import InTemporaryDirectory
@@ -286,12 +287,14 @@ def test_labeltable_deprecations():
286287

287288
# Test deprecation
288289
with clear_and_catch_warnings() as w:
289-
warnings.filterwarnings('once', category=DeprecationWarning)
290+
warnings.filterwarnings('always', category=DeprecationWarning)
290291
assert_equal(lt, img.get_labeltable())
292+
assert_equal(len(w), 1)
291293

292294
with clear_and_catch_warnings() as w:
293-
warnings.filterwarnings('once', category=DeprecationWarning)
295+
warnings.filterwarnings('always', category=DeprecationWarning)
294296
img.set_labeltable(lt)
297+
assert_equal(len(w), 1)
295298
assert_equal(lt, img.labeltable)
296299

297300

@@ -313,3 +316,17 @@ def test_parse_dataarrays():
313316
load(fn)
314317
assert_equal(len(w), 1)
315318
assert_equal(img.numDA, 0)
319+
320+
def test_parse_deprecated():
321+
322+
323+
# Test deprecation
324+
with clear_and_catch_warnings() as w:
325+
warnings.filterwarnings('always', category=DeprecationWarning)
326+
op = Outputter()
327+
assert_equal(len(w), 1)
328+
329+
with clear_and_catch_warnings() as w:
330+
warnings.filterwarnings('always', category=DeprecationWarning)
331+
assert_raises(ValueError, parse_gifti_file)
332+
assert_equal(len(w), 1)

0 commit comments

Comments
 (0)