MCPcopy Index your code
hub / github.com/ipython/ipython / _is_mocked

Function _is_mocked

IPython/testing/plugin/pytest_ipdoctest.py:560–566  ·  view source on GitHub ↗

Return if an object is possibly a mock object by checking the existence of a highly improbable attribute.

(obj: object)

Source from the content-addressed store, hash-verified

558
559
560def _is_mocked(obj: object) -> bool:
561 """Return if an object is possibly a mock object by checking the
562 existence of a highly improbable attribute."""
563 return (
564 safe_getattr(obj, "pytest_mock_example_attribute_that_shouldnt_exist", None)
565 is not None
566 )
567
568
569@contextmanager

Callers 2

_mock_aware_unwrapFunction · 0.85
_findMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…