Skip to content

Commit 09bcf7f

Browse files
authored
Merge pull request #1958 from rowillia/master
Remove implementation of `__getslice__`
2 parents e5deb8a + f1c4cfe commit 09bcf7f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

_pytest/_code/source.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ def __getitem__(self, key):
6060
else:
6161
if key.step not in (None, 1):
6262
raise IndexError("cannot slice a Source with a step")
63-
return self.__getslice__(key.start, key.stop)
63+
newsource = Source()
64+
newsource.lines = self.lines[key.start:key.stop]
65+
return newsource
6466

6567
def __len__(self):
6668
return len(self.lines)
6769

68-
def __getslice__(self, start, end):
69-
newsource = Source()
70-
newsource.lines = self.lines[start:end]
71-
return newsource
72-
7370
def strip(self):
7471
""" return new source object with trailing
7572
and leading blank lines removed.

0 commit comments

Comments
 (0)