Skip to content

Commit 8419650

Browse files
committed
chore: using subTest to distinguish which method failed
1 parent 62b2801 commit 8419650

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/test/test_bytes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,16 +2067,17 @@ def __init__(self, ba):
20672067
self.ba = ba
20682068
def __index__(self):
20692069
self.ba.clear()
2070-
return 65
2070+
return ord("A")
20712071

20722072
def make_case():
20732073
ba = bytearray(b"A")
20742074
return ba, Evil(ba)
20752075

20762076
for name in ("find", "count", "index", "rindex", "rfind"):
20772077
ba, evil = make_case()
2078-
with self.assertRaises(BufferError):
2079-
getattr(ba, name)(evil)
2078+
with self.subTest(name):
2079+
with self.assertRaises(BufferError):
2080+
getattr(ba, name)(evil)
20802081

20812082

20822083
class AssortedBytesTest(unittest.TestCase):

0 commit comments

Comments
 (0)