MCPcopy Create free account
hub / github.com/pytest-dev/pytest / safe_isclass

Function safe_isclass

src/_pytest/compat.py:334–339  ·  view source on GitHub ↗

Ignore any exception via isinstance on Python 3.

(obj: object)

Source from the content-addressed store, hash-verified

332
333
334def safe_isclass(obj: object) -> bool:
335 """Ignore any exception via isinstance on Python 3."""
336 try:
337 return inspect.isclass(obj)
338 except Exception:
339 return False
340
341
342if TYPE_CHECKING:

Callers 2

test_safe_isclassFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_safe_isclassFunction · 0.72