@@ -211,6 +211,8 @@ def cmd_UNSELECT(self, tag, args):
211211class IdleCmdHandler (SimpleIMAPHandler ):
212212 capabilities = 'IDLE'
213213 def cmd_IDLE (self , tag , args ):
214+ # pre-idle-continuation response
215+ self ._send_line (b'* 0 EXISTS' )
214216 self ._send_textline ('+ idling' )
215217 # simple response
216218 self ._send_line (b'* 2 EXISTS' )
@@ -530,6 +532,9 @@ def test_idle_iter(self):
530532 client , _ = self ._setup (IdleCmdHandler )
531533 client .login ('user' , 'pass' )
532534 with client .idle () as idler :
535+ # iteration should include response between 'IDLE' & '+ idling'
536+ response = next (idler )
537+ self .assertEqual (response , ('EXISTS' , [b'0' ]))
533538 # iteration should produce responses
534539 response = next (idler )
535540 self .assertEqual (response , ('EXISTS' , [b'2' ]))
@@ -557,7 +562,7 @@ def test_idle_burst(self):
557562 # burst() should yield immediately available responses
558563 with client .idle () as idler :
559564 batch = list (idler .burst ())
560- self .assertEqual (len (batch ), 3 )
565+ self .assertEqual (len (batch ), 4 )
561566 # burst() should not have consumed later responses
562567 _ , data = client .response ('RECENT' )
563568 self .assertEqual (data , [b'1' ])
0 commit comments