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