MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _try_iter

Function _try_iter

tools/python-3.11.9-amd64/Lib/unittest/mock.py:1085–1097  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1083
1084
1085def _try_iter(obj):
1086 if obj is None:
1087 return obj
1088 if _is_exception(obj):
1089 return obj
1090 if _callable(obj):
1091 return obj
1092 try:
1093 return iter(obj)
1094 except TypeError:
1095 # XXXX backwards compatibility
1096 # but this will blow up on first call - so maybe we should fail early?
1097 return obj
1098
1099
1100class CallableMixin(Base):

Callers 1

__set_side_effectMethod · 0.85

Calls 2

_is_exceptionFunction · 0.85
_callableFunction · 0.85

Tested by

no test coverage detected