Doctest code does not take into account `@property`, this is a hackish way to fix it. https://bugs.python.org/issue17446 Wrapped Doctests will need to be unwrapped so the correct line number is returned. This will be reported upstream. #8796
(self, obj, source_lines)
| 503 | """ |
| 504 | |
| 505 | def _find_lineno(self, obj, source_lines): |
| 506 | """Doctest code does not take into account `@property`, this |
| 507 | is a hackish way to fix it. https://bugs.python.org/issue17446 |
| 508 | |
| 509 | Wrapped Doctests will need to be unwrapped so the correct |
| 510 | line number is returned. This will be reported upstream. #8796 |
| 511 | """ |
| 512 | if isinstance(obj, property): |
| 513 | obj = getattr(obj, "fget", obj) |
| 514 | |
| 515 | if hasattr(obj, "__wrapped__"): |
| 516 | # Get the main obj in case of it being wrapped |
| 517 | obj = inspect.unwrap(obj) |
| 518 | |
| 519 | # Type ignored because this is a private function. |
| 520 | return super()._find_lineno( # type:ignore[misc] |
| 521 | obj, |
| 522 | source_lines, |
| 523 | ) |
| 524 | |
| 525 | def _find( |
| 526 | self, tests, obj, name, module, source_lines, globs, seen |
nothing calls this directly
no outgoing calls
no test coverage detected