コード例 #1
0
 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()))
コード例 #2
0
ファイル: code.py プロジェクト: LLNL/spack
 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()))
コード例 #3
0
 def statement(self):
     """ _pytest._code.Source object for the current statement """
     source = self.frame.code.fullsource
     return source.getstatement(self.lineno)
コード例 #4
0
ファイル: code.py プロジェクト: LLNL/spack
 def statement(self):
     """ _pytest._code.Source object for the current statement """
     source = self.frame.code.fullsource
     return source.getstatement(self.lineno)
コード例 #5
0
 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)