MCPcopy Create free account
hub / github.com/pytest-dev/pytest / getstatement

Method getstatement

src/_pytest/_code/source.py:90–94  ·  view source on GitHub ↗

Return Source statement which contains the given linenumber (counted from 0).

(self, lineno: int)

Source from the content-addressed store, hash-verified

88 return newsource
89
90 def getstatement(self, lineno: int) -> "Source":
91 """Return Source statement which contains the given linenumber
92 (counted from 0)."""
93 start, end = self.getstatementrange(lineno)
94 return self[start:end]
95
96 def getstatementrange(self, lineno: int) -> Tuple[int, int]:
97 """Return (start, end) tuple which spans the minimal statement region

Callers 5

statementMethod · 0.80
statementMethod · 0.80
_getindentMethod · 0.80
test_getstatementMethod · 0.80

Calls 1

getstatementrangeMethod · 0.95

Tested by 2

test_getstatementMethod · 0.64