Python instance object the function is bound to. Returns None if not a test method, e.g. for a standalone test function, a staticmethod, a class or a module.
(self)
| 280 | |
| 281 | @property |
| 282 | def instance(self): |
| 283 | """Python instance object the function is bound to. |
| 284 | |
| 285 | Returns None if not a test method, e.g. for a standalone test function, |
| 286 | a staticmethod, a class or a module. |
| 287 | """ |
| 288 | node = self.getparent(Function) |
| 289 | return getattr(node.obj, "__self__", None) if node is not None else None |
| 290 | |
| 291 | @property |
| 292 | def obj(self): |