@@ -327,17 +327,18 @@ def test_iter(self):
327
327
strs = "google" , "wikimedia" , "wikipedia" , "wikitravel"
328
328
ds = Series (strs )
329
329
330
- for s in ds .str :
331
- # iter must yield a Series
332
- assert isinstance (s , Series )
330
+ with tm .assert_produces_warning (FutureWarning ):
331
+ for s in ds .str :
332
+ # iter must yield a Series
333
+ assert isinstance (s , Series )
333
334
334
- # indices of each yielded Series should be equal to the index of
335
- # the original Series
336
- tm .assert_index_equal (s .index , ds .index )
335
+ # indices of each yielded Series should be equal to the index of
336
+ # the original Series
337
+ tm .assert_index_equal (s .index , ds .index )
337
338
338
- for el in s :
339
- # each element of the series is either a basestring/str or nan
340
- assert isinstance (el , str ) or isna (el )
339
+ for el in s :
340
+ # each element of the series is either a basestring/str or nan
341
+ assert isinstance (el , str ) or isna (el )
341
342
342
343
# desired behavior is to iterate until everything would be nan on the
343
344
# next iter so make sure the last element of the iterator was 'l' in
@@ -349,8 +350,9 @@ def test_iter_empty(self):
349
350
350
351
i , s = 100 , 1
351
352
352
- for i , s in enumerate (ds .str ):
353
- pass
353
+ with tm .assert_produces_warning (FutureWarning ):
354
+ for i , s in enumerate (ds .str ):
355
+ pass
354
356
355
357
# nothing to iterate over so nothing defined values should remain
356
358
# unchanged
@@ -360,8 +362,9 @@ def test_iter_empty(self):
360
362
def test_iter_single_element (self ):
361
363
ds = Series (["a" ])
362
364
363
- for i , s in enumerate (ds .str ):
364
- pass
365
+ with tm .assert_produces_warning (FutureWarning ):
366
+ for i , s in enumerate (ds .str ):
367
+ pass
365
368
366
369
assert not i
367
370
tm .assert_series_equal (ds , s )
@@ -371,8 +374,9 @@ def test_iter_object_try_string(self):
371
374
372
375
i , s = 100 , "h"
373
376
374
- for i , s in enumerate (ds .str ):
375
- pass
377
+ with tm .assert_produces_warning (FutureWarning ):
378
+ for i , s in enumerate (ds .str ):
379
+ pass
376
380
377
381
assert i == 100
378
382
assert s == "h"
0 commit comments