@@ -384,9 +384,9 @@ def test_readuntil_separator(self):
384
384
with self .assertRaisesRegex (ValueError , 'Separator should be' ):
385
385
self .loop .run_until_complete (stream .readuntil (separator = b'' ))
386
386
with self .assertRaisesRegex (ValueError , 'Separator should be' ):
387
- self .loop .run_until_complete (stream .readuntil (separator = [ b'' ] ))
387
+ self .loop .run_until_complete (stream .readuntil (separator = ( b'' ,) ))
388
388
with self .assertRaisesRegex (ValueError , 'Separator should contain' ):
389
- self .loop .run_until_complete (stream .readuntil (separator = [] ))
389
+ self .loop .run_until_complete (stream .readuntil (separator = () ))
390
390
391
391
def test_readuntil_multi_chunks (self ):
392
392
stream = asyncio .StreamReader (loop = self .loop )
@@ -475,15 +475,15 @@ def test_readuntil_multi_separator(self):
475
475
476
476
# Simple case
477
477
stream .feed_data (b'line 1\n line 2\r ' )
478
- data = self .loop .run_until_complete (stream .readuntil ([ b'\r ' , b'\n ' ] ))
478
+ data = self .loop .run_until_complete (stream .readuntil (( b'\r '
57A6
, b'\n ' ) ))
479
479
self .assertEqual (b'line 1\n ' , data )
480
- data = self .loop .run_until_complete (stream .readuntil ([ b'\r ' , b'\n ' ] ))
480
+ data = self .loop .run_until_complete (stream .readuntil (( b'\r ' , b'\n ' ) ))
481
481
self .assertEqual (b'line 2\r ' , data )
482
482
self .assertEqual (b'' , stream ._buffer )
483
483
484
484
# First end position matches, even if that's a longer match
485
485
stream .feed_data (b'ABCDEFG' )
486
- data = self .loop .run_until_complete (stream .readuntil ([ b'DEF' , b'BCDE' ] ))
486
+ data = self .loop .run_until_complete (stream .readuntil (( b'DEF' , b'BCDE' ) ))
487
487
self .assertEqual (b'ABCDE' , data )
488
488
self .assertEqual (b'FG' , stream ._buffer )
489
489
@@ -493,7 +493,7 @@ def test_readuntil_multi_separator_limit(self):
493
493
494
494
with self .assertRaisesRegex (asyncio .LimitOverrunError ,
495
495
'is found' ) as cm :
496
- self .loop .run_until_complete (stream .readuntil ([ b'A' , b'ome dataA' ] ))
496
+ self .loop .run_until_complete (stream .readuntil (( b'A' , b'ome dataA' ) ))
497
497
498
498
self .assertEqual (b'some dataA' , stream ._buffer )
499
499
@@ -504,14 +504,21 @@ def test_readuntil_multi_separator_negative_offset(self):
504
504
stream = asyncio .StreamReader (loop = self .loop )
505
505
stream .feed_data (b'data' )
506
506
507
- readuntil_task = self .loop .create_task (stream .readuntil ([ b'A' , b'long sep' ] ))
507
+ readuntil_task = self .loop .create_task (stream .readuntil (( b'A' , b'long sep' ) ))
508
508
self .loop .call_soon (stream .feed_data , b'Z' )
509
509
self .loop .call_soon (stream .feed_data , b'Aaaa' )
510
510
511
511
data = self .loop .run_until_complete (readuntil_task )
512
512
self .assertEqual (b'dataZA' , data )
513
513
self .assertEqual (b'aaa' , stream ._buffer )
514
514
515
+ def test_readuntil_bytearray (self ):
516
+ stream = asyncio .StreamReader (loop = self .loop )
517
+ stream .feed_data (b'some data\r \n ' )
518
+ data = self .loop .run_until_complete (stream .readuntil (bytearray (b'\r \n ' )))
519
+ self .assertEqual (b'some data\r \n ' , data )
520
+ self .assertEqual (b'' , stream ._buffer )
521
+
515
522
def test_readexactly_zero_or_less (self ):
516
523
# Read exact number of bytes (zero or less).
517
524
stream = asyncio .StreamReader (loop = self .loop )
0 commit comments