
     f"                         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ZddZdd	Zdd
Zeee
edeiZddZddZddZ ddZ!ddZ"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                  J   t                      } | j        t          t          t          t          ik    sJ |                     t          t                     | j        t          t          t          t          ik    sJ t          j
        t                    5  |                     t          t                     d d d            n# 1 swxY w Y   | j        t          t          t          t          ik    sJ |                     t          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                     | j        t          t          t          t          ik    sJ |                     t          t                      | j        t          t"          t          t$          ik    sJ d S N)r   statesr   r   r   process_eventr	   r   r   pytestraisesr   r   r
   r   r   r   r   r   css    W/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/h11/tests/test_state.pytest_ConnectionStater#      s   			B 9vt44444VW%%%9FMBBBBB 
)	*	* * *
)))* * * * * * * * * * * * * * *9FMBBBBBV23339FMBBBBBVX&&&9FI>>>>>V\***V\***9vt44444 V-...9VV<<<<<<<s   !B??CCc                     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    sJ d S r   )r   r   r   r	   process_keep_alive_disabledr   r   r   r   r   r
   r    s    r"   test_ConnectionState_keep_aliver&   >   s    			BVW%%%""$$$V\***9V]CCCCCVX&&&V\***9VZ@@@@@@@    c                  6   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    s    r"   'test_ConnectionState_keep_alive_in_DONEr)   K   s     
		BVW%%%V\***9V$$$$""$$$9V
******r'   c                     t           t          fD ]} dD ]}t                      }|                    |            |                    t
          t                     |                    t
          t                     |j        t
          t          t          t          ik    sJ | |j        v sJ |r)|                    t          t                     |j        rJ |                    t
          t                     |r'|j        t
          t          t          t          ik    sJ 
|j        t
          t           t          t          ik    sJ |                    t          t"                     |j        t
          t           t          t          ik    sJ |                    t          t                     |j        t
          t          t          t          ik    sJ |j        rJ Đ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!   s      r"   "test_ConnectionState_switch_deniedr/   W   s   '9 !7 !7'  	7  	7J ""B--k:::VW---VT***9FM JJJJJ""===== 7  2226666V\222 7yVT69$EEEEEEy1M%    
   )>???y1M%    
   222yVT69$EEEEE66666A 	7!7 !7r'   c                     t           t          fD ]a} t                      }|                    |            |                    t
          t                     |                    t
          t                     |j        t
          t          t          t          ik    sJ |                    t
          t                     |j        t
          t          t          t          ik    sJ |                    t          t                     |j        t
          t          t          t          ik    sJ |                    t          t          |          |            |j        t
          t           t          t           ik    sJ cd S r   )r   r   r   r+   r   r   r	   r   r   r   r   r   r   r   r   _response_type_for_switchr   )switch_eventr!   s     r"   -test_ConnectionState_protocol_switch_acceptedr3      s1   (/: S S
)),777
)))
&&&yVYFFFFF
...yV%:FMRRRRR
!6777yV%:FMRRRRR
!:<!H,WWWyV%6@QRRRRRRS Sr'   c                  d   d t           t          fD ]} t                      }|                    t                      |                    t                     |                    t
          t                     |                    t
          t                     |j        t
          t          t          t          ik    sJ |                    t          t          |          |            | &|j        t
          t          t          t          ik    sJ |j        t
          t          t          t          ik    sJ  d S r   )r   r   r   r+   r   r   r	   r   r   r   r   r   r1   r   r   r   )server_switchr!   s     r"   +test_ConnectionState_double_protocol_switchr6      s    A W W
))/:::
))/:::
)))
...yV%:FMRRRRR
-m<m	
 	
 	
  9vy AAAAAA9):FDU VVVVVVW Wr'   c                     g t           fg t          ft          gt           ft           gt          ffD ]\  } }t                      }| D ]}|                    |           |                    t
          t                     t          j        t                    5  |                    t          t          |           d d d            n# 1 swxY w Y   d S r   )r   r   r   r+   r   r   r	   r   r   r   r   r
   )client_switchesr5   r!   client_switchs       r"   1test_ConnectionState_inconsistent_protocol_switchr:      s   	_	_
	O,
	O,	+ > >& , 	= 	=M--m<<<<
)))]-.. 	> 	>VX}===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>> >s   "CC	
C	c                  \   t                      } |                     t                     |                     t          t
                     |                                  |                     t          t                     | j        t          t          t          t          ik    sJ |                     t          t                     | j        t          t          t          t          ik    sJ |                     t          t                     | j        t          t          t          t          ik    sJ d S r   )r   r+   r   r   r   r	   r%   r   r   r   r   r   r   r   r
   r   r    s    r"   :test_ConnectionState_keepalive_protocol_switch_interactionr<      s    			B%%o666VW%%%""$$$VT"""9FMBBBBB V\***9!6NNNNN VX&&&9VY???????r'   c                  	   t                      } t          j        t                    5  |                                  d d d            n# 1 swxY w Y   |                     t          t                     |                     t          t                     t          j        t                    5  |                                  d d d            n# 1 swxY w Y   |                     t          t                     |                     t          t                     |                                  | j        t          t          t          t          ik    sJ |                     t          t                     |                                  |                     t          t                     |                     t          t                     |                     t          t                     t          j        t                    5  |                                  d d d            n# 1 swxY w Y   t                      } |                     t          t                     |                     t          t                     |                     t          t                     |                     t          t                     |                     t          t                     t          j        t                    5  |                                  d d d            n# 1 swxY w Y   t                      } |                     t                      |                     t          t                     |                     t          t                     |                     t          t"          t                      t          j        t                    5  |                                  d d d            n# 1 swxY w 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    s    r"   test_ConnectionState_reuser?      s   			B	)	*	*  
               VW%%%V\***	)	*	*  
               VX&&&V\***9vt44444 VW%%%""$$$V\***VX&&&V\***	)	*	*  
              
 
		BVW%%%V\***V-...VX&&&V\***	)	*	*  
              
 
		B%%o666VW%%%V\***V2ODDD	)	*	*  
              
 
		B%%o666VW%%%V\***VX&&&V\***9vt4444444sY   A		AA-CCC?H  H$'H$2LLLO&&O*-O*c                      t                      } t          j        t                    5  |                     t
          t                     d d d            d S # 1 swxY w Y   d S r   )r   r   r   r   r   r   r	   r    s    r"   test_server_request_is_illegalrA   
  s     
		B	)	*	* * *
)))* * * * * * * * * * * * * * * * * *s   !AAA)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/   r1   r3   r6   r:   r<   r?   rA    r'   r"   <module>rF      s                                                  ' & & & & &= = = =@
A 
A 
A 
A	+ 	+ 	+ 	+"7 "7 "7 "7L *X( S S S S$W W W W&> > > >@ @ @ @$>5 >5 >5 >5B* * * * * *r'   