U
    e~                  	   @   s   d dl Z d dlmZ d dlZddlmZ ddddZejdej	d	d
dej	dddej	dddgee
 ddddZdS )    N)Tuple   )ReceiveBuffer)returnc                  C   s  t  } | rtt| dkstt| dks.t| d7 } | s>tt| dksNtt| dks^tt| dksnt| ddkst| stt| dkstt| dkstt| dkst| d	dkstt| dkst| d	d kst| rt| d
7 } |  dkstt| dks t|  dks2tt| dksDt| d7 } |  d ks^tt| dkspt| d7 } |  d kstt| dkst| d7 } |  dkst|  dkst|  d kstt| dkst| d7 } |  }|dddgkstt| dks"t|  d ks4t| d7 } |  d ksNt| ddksbt| rlt| d7 } |  g kstt| dkstd S )Nr       s   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

trailings   a: bs   foo:bars   trailings   
d   s   trailing
s
   
trailing)r   AssertionErrorlenbytesZmaybe_extract_at_mostZmaybe_extract_next_linemaybe_extract_lines)blines r   ]/var/www/html/assets/scripts/venv/lib/python3.8/site-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_lf)r   r   c                 C   sF   t  }| D ]}||7 }q
| }|dddgks2tt|dksBtd S )Ns   HTTP/1.1 200 OKs   Content-type: text/plains   Connection: closer   )r   r   r   r   )r   r   liner   r   r   r   (test_receivebuffer_for_invalid_delimiterW   s    $

r   )retypingr   ZpytestZ_receivebufferr   r   markZparametrizeparamr   r   r   r   r   r   <module>   s*   N

#