MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_idle_iter

Method test_idle_iter

Lib/test/test_imaplib.py:574–602  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

572 pass
573
574 def test_idle_iter(self):
575 client, _ = self._setup(IdleCmdHandler)
576 client.login('user', 'pass')
577 with client.idle() as idler:
578 # iteration should include response between 'IDLE' & '+ idling'
579 response = next(idler)
580 self.assertEqual(response, ('EXISTS', [b'0']))
581 # iteration should produce responses
582 response = next(idler)
583 self.assertEqual(response, ('EXISTS', [b'2']))
584 # fragmented response (with literal string) should arrive whole
585 expected_fetch_data = [
586 (b'1 (BODY[HEADER.FIELDS (DATE)] {41}',
587 b'Date: Fri, 06 Dec 2024 06:00:00 +0000\r\n\r\n'),
588 b')']
589 typ, data = next(idler)
590 self.assertEqual(typ, 'FETCH')
591 self.assertEqual(data, expected_fetch_data)
592 # response after a fragmented one should arrive separately
593 response = next(idler)
594 self.assertEqual(response, ('EXISTS', [b'3']))
595 # iteration should have consumed untagged responses
596 _, data = client.response('EXISTS')
597 self.assertEqual(data, [None])
598 # responses not iterated should be available after idle
599 _, data = client.response('RECENT')
600 self.assertEqual(data[0], b'1')
601 # responses received after 'DONE' should be available after idle
602 self.assertEqual(data[1], b'9')
603
604 def test_idle_burst(self):
605 client, _ = self._setup(IdleCmdHandler)

Callers

nothing calls this directly

Calls 6

_setupMethod · 0.95
nextFunction · 0.85
idleMethod · 0.80
responseMethod · 0.80
loginMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected