def _getindent(self, source): # figure out indent for given source try: s = str(source.getstatement(len(source) - 1)) except KeyboardInterrupt: raise except: # noqa try: s = str(source[-1]) except KeyboardInterrupt: raise except: # noqa return 0 return 4 + (len(s) - len(s.lstrip()))
def statement(self): """ _pytest._code.Source object for the current statement """ source = self.frame.code.fullsource return source.getstatement(self.lineno)
def statement(self) -> "Source": """ _pytest._code.Source object for the current statement """ source = self.frame.code.fullsource assert source is not None return source.getstatement(self.lineno)