Skip to content

Commit

Permalink
use a subTest for sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
gpshead committed Jan 20, 2025
1 parent 1c74be4 commit d71a7ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,16 +902,18 @@ def handle(self):
self.imap_class, *server.server_address)

def test_truncated_large_literal(self):
size = 0
class BadHandler(SimpleIMAPHandler):
def handle(self):
self._send_textline('* OK {%d}' % size)
self._send_textline('IMAP4rev1')

for exponent in range(15, 64):
size = 1 << exponent
with self.reaped_server(BadHandler) as server:
with self.assertRaises(imaplib.IMAP4.abort):
self.imap_class(*server.server_address)
with self.subTest(f"size=2e{size}"):
with self.reaped_server(BadHandler) as server:
with self.assertRaises(imaplib.IMAP4.abort):
self.imap_class(*server.server_address)

@threading_helper.reap_threads
def test_simple_with_statement(self):
Expand Down

0 comments on commit d71a7ee

Please sign in to comment.