Format: application/x-python-code
⬇ Download File (2.2 KB)
   1  o
   2  
   3  .'h~
   4  �	@s~ddlZddlmZddlZddlmZddd�Zej�dej	d	d
   5  d�ej	dd
   6  d�ej	ddd�g�dee
   7  ddfdd��ZdS)�N)�Tuple�)�
   8  ReceiveBuffer�returncCs�t�}|rJ�t|�dksJ�t|�dksJ�|d7}|sJ�t|�dks'J�t|�dks/J�t|�dks7J�|�d�dks@J�|sDJ�t|�dksLJ�t|�dksTJ�t|�dks\J�|�d	�dkseJ�t|�dksmJ�|�d	�dusvJ�|rzJ�|d
   9  7}|��dks�J�t|�dks�J�|��dks�J�t|�dks�J�|d
  10  7}|��dus�J�t|�d
  11  ks�J�|d7}|��dus�J�t|�dks�J�|d7}|��dks�J�|��dks�J�|��dus�J�t|�dks�J�|d7}|��}|gd�ks�J�t|�dk�sJ�|��du�sJ�|d7}|��du�sJ�|�d�dk�s#J�|�r(J�|d7}|��gk�s5J�t|�dk�s>J�dS)Nr��123�rs12��3�
  12  s123
  13  456
  14  789
  15  s	123
  16  456
  17  s789
  18  s12
  19  s345
  20  
  21  s12
  22  345
  23  
  24  s
  25  
  26  6789aaa123
  27  s	12
  28  345
  29  
  30  s6789aaa123
  31  s123
  32  a: b
  33  foo:bar
  34  
  35  trailing)rsa: bsfoo:barstrailings
  36  
  37  �dstrailing
  38  
  39  s
  40  
  41  trailing)r�len�bytesZmaybe_extract_at_mostZmaybe_extract_next_line�maybe_extract_lines)�b�lines�r�RC:\Users\shubh\Videos\agent\nova\Lib\site-packages\h11/tests/test_receivebuffer.py�test_receivebuffer	s\
  42  r�data)sHTTP/1.1 200 OK
  43  �Content-type: text/plain
  44  sConnection: close
  45  s
  46  �	Some bodyZwith_crlf_delimiter)�id)�HTTP/1.1 200 OK
  47  sContent-type: text/plain
  48  �Connection: close
  49  �
  50  rZwith_lf_only_delimiter)rrrrrZwith_mixed_crlf_and_lfcCsDt�}|D]}||7}q|��}|gd�ksJ�t|�dks J�dS)N)sHTTP/1.1 200 OKsContent-type: text/plainsConnection: closer)rrr)rr�linerrrr�(test_receivebuffer_for_invalid_delimiterWs$
  51  r)rN)�re�typingrZpytestZ_receivebufferrr�markZparametrize�paramrrrrrr�<module>s,
  52  N�
  53  �
  54  ���#