o
    ʋi"                     @   s   d dl Z ddlmZmZmZmZmZmZmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ dddZdd	d
ZdddZdddZeee
edeiZdddZdddZdddZ dddZ!dddZ"dddZ#dS )    N   )ConnectionClosedDataEndOfMessageEventInformationalResponseRequestResponse)_SWITCH_CONNECT_SWITCH_UPGRADECLIENTCLOSEDConnectionStateDONEIDLEMIGHT_SWITCH_PROTOCOL
MUST_CLOSE	SEND_BODYSEND_RESPONSESERVERSWITCHED_PROTOCOL)LocalProtocolErrorreturnc                  C   s"  t  } | jttttiksJ | tt | jttttiksJ t	
t | tt W d    n1 s5w   Y  | jttttiksEJ | tt | jttttiksVJ | tt | jttttiksgJ | tt | tt | jttttiks~J | tt | jttttiksJ d S N)r   statesr   r   r   process_eventr   r   r   pytestraisesr   r   r	   r   r   r   r   r   cs r    X/home/air/goalskill_sales/back/venv/lib/python3.10/site-packages/h11/tests/test_state.pytest_ConnectionState   s"   r"   c                  C   sn   t  } | tt |   | tt | jtttt	iksJ | tt
 | tt | jttttiks5J d S r   )r   r   r   r   process_keep_alive_disabledr   r   r   r   r   r	   r   r    r    r!   test_ConnectionState_keep_alive>   s   r$   c                  C   sN   t  } | tt | tt | jt tu sJ |   | jt tu s%J d S r   )	r   r   r   r   r   r   r   r#   r   r   r    r    r!   'test_ConnectionState_keep_alive_in_DONEK   s   r%   c                  C   s  t tfD ]} dD ]{}t }||  |tt |tt |jtt	t
tiks)J | |jv s0J |r=|t
t |jr=J |tt |rQ|jttt
t	iksPJ q|jttt
tiks\J |t
t |jttt
tiksmJ |t
t |jttt
t	iks~J |jrJ qqd S )N)TF)r
   r   r   process_client_switch_proposalr   r   r   r   r   r   r   r   pending_switch_proposalsr	   r   r   r   r   )switch_type
deny_earlyr   r    r    r!   "test_ConnectionState_switch_deniedW   s8   



r*   c                  C   s   t tfD ]W} t }||  |tt |tt |jtt	t
tiks%J |tt |jttt
tiks6J |t
t |jttt
tiksGJ |t
t|  |  |jttt
tiks[J qd S r   )r   r
   r   r&   r   r   r   r   r   r   r   r   r   r   r   _response_type_for_switchr   )switch_eventr   r    r    r!   -test_ConnectionState_protocol_switch_accepted   s   
r-   c                  C   s   d t tfD ]J} t }|t  |t |tt |tt |jtt	t
tiks+J |t
t|  |  | d u rD|jttt
tiksCJ q|jttt
tiksOJ qd S r   )r   r
   r   r&   r   r   r   r   r   r   r   r   r+   r   r   r   )server_switchr   r    r    r!   +test_ConnectionState_double_protocol_switch   s   


r/   c               	   C   s   g t fg tftgt ft gtffD ]3\} }t }| D ]}|| q|tt tt	 |t
t| W d    n1 s>w   Y  qd S r   )r
   r   r   r&   r   r   r   r   r   r   r   r	   )client_switchesr.   r   client_switchr    r    r!   1test_ConnectionState_inconsistent_protocol_switch   s   r2   c                  C   s   t  } | t | tt |   | tt | jtt	t
tiks#J | tt | jttt
tiks4J | t
t | jttt
t	iksEJ d S r   )r   r&   r   r   r   r   r#   r   r   r   r   r   r   r   r	   r   r   r    r    r!   :test_ConnectionState_keepalive_protocol_switch_interaction   s   
r3   c                  C   sb  t  } tt |   W d    n1 sw   Y  | tt | tt tt |   W d    n1 s<w   Y  | t	t
 | t	t |   | jttt	tiks\J | tt |   | tt | t	t
 | t	t tt |   W d    n1 sw   Y  t  } | tt | tt | tt | t	t
 | t	t tt |   W d    n1 sw   Y  t  } | t | tt | tt | t	tt tt |   W d    n1 sw   Y  t  } | t | tt | tt | t	t
 | t	t |   | jttt	tiks/J d S r   )r   r   r   r   start_next_cycler   r   r   r   r   r	   r   r   r#   r   r&   r   r   r   r    r    r!   test_ConnectionState_reuse   s\   






r5   c                  C   sB   t  } tt | tt W d    d S 1 sw   Y  d S r   )r   r   r   r   r   r   r   r   r    r    r!   test_server_request_is_illegal
  s   "r6   )r   N)$r   _eventsr   r   r   r   r   r   r	   _stater
   r   r   r   r   r   r   r   r   r   r   r   r   _utilr   r"   r$   r%   r*   r+   r-   r/   r2   r3   r5   r6   r    r    r    r!   <module>   s$    $<	

 

&




A