o
    US`c~                  	   @   s~   d dl Z d dlmZ d dlZddlmZ dddZejdej	d	d
dej	dddej	dddgdee
 ddfddZdS )    N)Tuple   )ReceiveBufferreturnc                  C   s  t  } | rJ t| dksJ t| dksJ | d7 } | sJ t| dks'J t| dks/J t| dks7J | ddks@J | sDJ t| dksLJ t| dksTJ t| dks\J | d	dkseJ t| dksmJ | d	d u svJ | rzJ | d
7 } |  dksJ t| dksJ |  dksJ t| dksJ | d7 } |  d u sJ t| dksJ | d7 } |  d u sJ t| dksJ | d7 } |  dksJ |  dksJ |  d u sJ t| dksJ | d7 } |  }|g dksJ t| dksJ |  d u sJ | d7 } |  d u sJ | ddks#J | r(J | d7 } |  g ks5J t| dks>J d S )Nr          123   r   s   12      3
   s   123
456
789
s	   123
456
s   789
s   12s   345
s   12345
s   
6789aaa123
s	   12345

s   6789aaa123
s   123
a: b
foo:bar

trailing)r   s   a: bs   foo:bars   trailings   
d   s   trailing
s
   
trailing)r   lenbytesZmaybe_extract_at_mostZmaybe_extract_next_linemaybe_extract_lines)blines r   G/usr/local/lib/python3.10/dist-packages/h11/tests/test_receivebuffer.pytest_receivebuffer	   s\   
r   data)s   HTTP/1.1 200 OK
   Content-type: text/plain
s   Connection: close
s   
	   Some bodyZwith_crlf_delimiter)id)   HTTP/1.1 200 OK
s   Content-type: text/plain
   Connection: close
   
r   Zwith_lf_only_delimiter)r   r   r   r   r   Zwith_mixed_crlf_and_lfc                 C   sD   t  }| D ]}||7 }q| }|g dksJ t|dks J d S )N)s   HTTP/1.1 200 OKs   Content-type: text/plains   Connection: closer   )r   r   r   )r   r   liner   r   r   r   (test_receivebuffer_for_invalid_delimiterW   s   $
r   )r   N)retypingr   ZpytestZ_receivebufferr   r   markZparametrizeparamr   r   r   r   r   r   <module>   s,    
N

#