Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee71f4a

Browse files
committed
#17334: merge with 3.3.
2 parents 5c67e22 + bce9a5d commit ee71f4a

2 files changed

Lines changed: 11 additions & 21 deletions

File tree

Lib/test/test_index.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_error(self):
5656
self.assertRaises(TypeError, slice(self.n).indices, 0)
5757

5858

59-
class SeqTestCase(unittest.TestCase):
59+
class SeqTestCase:
6060
# This test case isn't run directly. It just defines common tests
6161
# to the different sequence types below
6262
def setUp(self):
@@ -126,7 +126,7 @@ def test_error(self):
126126
self.assertRaises(TypeError, sliceobj, self.n, self)
127127

128128

129-
class ListTestCase(SeqTestCase):
129+
class ListTestCase(SeqTestCase, unittest.TestCase):
130130
seq = [0,10,20,30,40,50]
131131

132132
def test_setdelitem(self):
@@ -182,19 +182,19 @@ def __getitem__(self, index):
182182
return self._list[index]
183183

184184

185-
class TupleTestCase(SeqTestCase):
185+
class TupleTestCase(SeqTestCase, unittest.TestCase):
186186
seq = (0,10,20,30,40,50)
187187

188-
class ByteArrayTestCase(SeqTestCase):
188+
class ByteArrayTestCase(SeqTestCase, unittest.TestCase):
189189
seq = bytearray(b"this is a test")
190190

191-
class BytesTestCase(SeqTestCase):
191+
class BytesTestCase(SeqTestCase, unittest.TestCase):
192192
seq = b"this is a test"
193193

194-
class StringTestCase(SeqTestCase):
194+
class StringTestCase(SeqTestCase, unittest.TestCase):
195195
seq = "this is a test"
196196

197-
class NewSeqTestCase(SeqTestCase):
197+
class NewSeqTestCase(SeqTestCase, unittest.TestCase):
198198
seq = NewSeq((0,10,20,30,40,50))
199199

200200

@@ -237,18 +237,5 @@ def test_sequence_repeat(self):
237237
self.assertRaises(OverflowError, lambda: "a" * self.neg)
238238

239239

240-
def test_main():
241-
support.run_unittest(
242-
BaseTestCase,
243-
ListTestCase,
244-
TupleTestCase,
245-
BytesTestCase,
246-
ByteArrayTestCase,
247-
StringTestCase,
248-
NewSeqTestCase,
249-
RangeTestCase,
250-
OverflowTestCase,
251-
)
252-
253240
if __name__ == "__main__":
254-
test_main()
241+
unittest.main()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,9 @@ Tests
899899

900900
- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host.
901901

902+
- Issue #17334: test_index now works with unittest test discovery.
903+
Patch by Zachary Ware.
904+
902905
- Issue #17333: test_imaplib now works with unittest test discovery.
903906
Patch by Zachary Ware.
904907

0 commit comments

Comments
 (0)