Path 1: 12 calls (1.0)

test_reference_cycle_dataclass..Example (6) ExampleDataclass (3) test_max_depth_dataclass..Foo (2) test_max_depth_dataclass..B...

True (12)

1def _is_dataclass_repr(obj: object) -> bool:
2    """Check if an instance of a dataclass contains the default repr.
3
4    Args:
5        obj (object): A dataclass instance.
6
7    Returns:
8        bool: True if the default repr is used, False if there is a custom repr.
9    """
10    # Digging in to a lot of internals here
11    # Catching all exceptions in case something is missing on a non CPython implementation
12    try:
13        return obj.__repr__.__code__.co_filename == dataclasses.__file__
14    except Exception:  # pragma: no coverage
15        return False