a
    Zg~                  	   @   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J t| dksJ t| dks.J | d7 } | s>J t| dksNJ t| dks^J t| dksnJ | ddksJ | sJ t| dksJ t| dksJ t| dksJ | d	dksJ t| dksJ | d	d u sJ | rJ | d
7 } |  dksJ t| dks J |  dks2J t| dksDJ | d7 } |  d u s^J t| dkspJ | 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sJ t| dks J |  d u s2J | d7 } |  d u sLJ | ddks`J | rjJ | d7 } |  g ksJ t| dksJ 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   j/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/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   sD   t  }| D ]}||7 }q
| }|g dks0J 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   )retypingr   ZpytestZ_receivebufferr   r   markZparametrizeparamr   r   r   r   r   r   <module>   s*   N

#