Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a051b57

Browse files
committed
MNT: rearrange testing helper functions
1 parent f34aed0 commit a051b57

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/matplotlib/cbook.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,6 @@ def is_string_like(obj):
708708
return False
709709
return True
710710

711-
def is_list_like(obj):
712-
"""Returns whether the obj is iterable and not a string"""
713-
return not is_string_like(obj) and iterable(obj)
714711

715712
def is_sequence_of_strings(obj):
716713
"""

lib/matplotlib/testing/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
4+
import warnings
55
from contextlib import contextmanager
66

7+
from matplotlib.cbook import is_string_like, iterable
8+
9+
10+
def _is_list_like(obj):
11+
"""Returns whether the obj is iterable and not a string"""
12+
return not is_string_like(obj) and iterable(obj)
13+
714

815
# stolen from pandas
916
@contextmanager
@@ -34,16 +41,13 @@ def assert_produces_warning(expected_warning=Warning, filter_level="always",
3441
3542
..warn:: This is *not* thread-safe.
3643
"""
37-
import warnings
38-
from matplotlib.cbook import is_list_like
39-
4044
with warnings.catch_warnings(record=True) as w:
4145

4246
if clear is not None:
4347
# make sure that we are clearning these warnings
4448
# if they have happened before
4549
# to guarantee that we will catch them
46-
if not is_list_like(clear):
50+
if not _is_list_like(clear):
4751
clear = [clear]
4852
for m in clear:
4953
try:

0 commit comments

Comments
 (0)