Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: using subTest to distinguish which method failed
  • Loading branch information
fatelei committed Dec 12, 2025
commit 84196509710dc237422daaede22516e3338f45ce
7 changes: 4 additions & 3 deletions Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,16 +2067,17 @@ def __init__(self, ba):
self.ba = ba
def __index__(self):
self.ba.clear()
return 65
return ord("A")

def make_case():
ba = bytearray(b"A")
return ba, Evil(ba)

for name in ("find", "count", "index", "rindex", "rfind"):
ba, evil = make_case()
with self.assertRaises(BufferError):
getattr(ba, name)(evil)
with self.subTest(name):
with self.assertRaises(BufferError):
getattr(ba, name)(evil)


class AssortedBytesTest(unittest.TestCase):
Expand Down
Loading