We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e5deb8a + f1c4cfe commit 09bcf7fCopy full SHA for 09bcf7f
1 file changed
_pytest/_code/source.py
@@ -60,16 +60,13 @@ def __getitem__(self, key):
60
else:
61
if key.step not in (None, 1):
62
raise IndexError("cannot slice a Source with a step")
63
- return self.__getslice__(key.start, key.stop)
+ newsource = Source()
64
+ newsource.lines = self.lines[key.start:key.stop]
65
+ return newsource
66
67
def __len__(self):
68
return len(self.lines)
69
- def __getslice__(self, start, end):
- newsource = Source()
70
- newsource.lines = self.lines[start:end]
71
- return newsource
72
-
73
def strip(self):
74
""" return new source object with trailing
75
and leading blank lines removed.
0 commit comments