diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 0cc42be42d61e..98debb5e2ef7a 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -309,6 +309,10 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then pytest -q --doctest-modules pandas/core/arrays/boolean.py RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests dtypes/inference.py' ; echo $MSG + pytest -q --doctest-modules pandas/core/dtypes/inference.py -k "is_iterator" + RET=$(($RET + $?)) ; echo $MSG "DONE" + fi ### DOCSTRINGS ### diff --git a/pandas/core/dtypes/inference.py b/pandas/core/dtypes/inference.py index 9e9278052e35d..d78f7f1cfb981 100644 --- a/pandas/core/dtypes/inference.py +++ b/pandas/core/dtypes/inference.py @@ -106,21 +106,20 @@ def is_iterator(obj) -> bool: Returns ------- - is_iter : bool + bool Whether `obj` is an iterator. Examples -------- - >>> is_iterator([1, 2, 3]) + >>> is_iterator((x for x in [1, 2, 3])) True - >>> is_iterator(datetime(2017, 1, 1)) + >>> is_iterator([1, 2, 3]) False >>> is_iterator("foo") False >>> is_iterator(1) False """ - if not hasattr(obj, "__iter__"): return False