@@ -228,15 +228,16 @@ def test_labeltable():
228
228
def test_metadata ():
229
229
md = GiftiMetaData (key = 'value' )
230
230
# Old initialization methods
231
- nvpair = GiftiNVPairs ('key' , 'value' )
231
+ with pytest .warns (DeprecationWarning ) as w :
232
+ nvpair = GiftiNVPairs ('key' , 'value' )
232
233
with pytest .warns (FutureWarning ) as w :
233
234
md2 = GiftiMetaData (nvpair = nvpair )
234
235
assert len (w ) == 1
235
236
with pytest .warns (DeprecationWarning ) as w :
236
237
md3 = GiftiMetaData .from_dict ({'key' : 'value' })
237
238
assert md == md2 == md3 == {'key' : 'value' }
238
239
# .data as a list of NVPairs is going away
239
- with pytest .warns (FutureWarning ) as w :
240
+ with pytest .warns (DeprecationWarning ) as w :
240
241
assert md .data [0 ].name == 'key'
241
242
assert md .data [0 ].value == 'value'
242
243
assert len (w ) == 2
@@ -247,7 +248,7 @@ def test_metadata():
247
248
248
249
def test_metadata_list_interface ():
249
250
md = GiftiMetaData (key = 'value' )
250
- with pytest .warns (FutureWarning ):
251
+ with pytest .warns (DeprecationWarning ):
251
252
mdlist = md .data
252
253
assert len (mdlist ) == 1
253
254
assert mdlist [0 ].name == 'key'
@@ -264,7 +265,8 @@ def test_metadata_list_interface():
264
265
assert md ['foo' ] == 'bar'
265
266
266
267
# Append new NVPair
267
- nvpair = GiftiNVPairs ('key' , 'value' )
268
+ with pytest .warns (DeprecationWarning ) as w :
269
+ nvpair = GiftiNVPairs ('key' , 'value' )
268
270
mdlist .append (nvpair )
269
271
assert len (mdlist ) == 2
270
272
assert mdlist [1 ].name == 'key'
@@ -278,14 +280,16 @@ def test_metadata_list_interface():
278
280
assert len (md ) == 0
279
281
280
282
# Extension adds multiple keys
281
- foobar = GiftiNVPairs ('foo' , 'bar' )
283
+ with pytest .warns (DeprecationWarning ) as w :
284
+ foobar = GiftiNVPairs ('foo' , 'bar' )
282
285
mdlist .extend ([nvpair , foobar ])
283
286
assert len (mdlist ) == 2
284
287
assert len (md ) == 2
285
288
assert md == {'key' : 'value' , 'foo' : 'bar' }
286
289
287
290
# Insertion updates list order, though we don't attempt to preserve it in the dict
288
- lastone = GiftiNVPairs ('last' , 'one' )
291
+ with pytest .warns (DeprecationWarning ) as w :
292
+ lastone = GiftiNVPairs ('last' , 'one' )
289
293
mdlist .insert (1 , lastone )
290
294
assert len (mdlist ) == 3
291
295
assert len (md ) == 3
@@ -314,7 +318,8 @@ def test_metadata_list_interface():
314
318
assert md == {'last' : 'one' }
315
319
316
320
# And let's remove an old pair with a new object
317
- lastoneagain = GiftiNVPairs ('last' , 'one' )
321
+ with pytest .warns (DeprecationWarning ) as w :
322
+ lastoneagain = GiftiNVPairs ('last' , 'one' )
318
323
mdlist .remove (lastoneagain )
319
324
assert len (mdlist ) == 0
320
325
assert len (md ) == 0
0 commit comments