
    "j                         d Z ddlZddlZddlZej                  j                  dd       ddlmZ ddlm	Z	 ddl
mZmZmZ  G d d	ej                        Zed
k(  r ej"                          yy)z)Unit tests for the `ClientAsync` class.

    Nz..)ClientAsync   )awaiter)FakeStreamReaderFakeStreamWriterasync_patchc                   B    e Zd Zd Zed        Zed        Zed        Zy)TestClientAsyncc                 "    t               | _        y N)r   clientselfs    `/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/test_async/test_client_async.pysetUpzTestClientAsync.setUp   s    !m    c                    K   | j                  t              5  | j                  j                          d {    d d d        y 7 # 1 sw Y   y xY wwr   )assertRaisesRuntimeErrorr   create_connectionr   s    r   test_create_connection_failz+TestClientAsync.test_create_connection_fail   sG     |, 	2++//111	2 	21	2 	2s+   AAAA	AAAAc                 J  K   t        dt               t               f      5  t        dj                  t              g d      5  | j                  | j                  j                  d       d {          d d d        d d d        y 7 # 1 sw Y   xY w# 1 sw Y   y xY ww)Nasyncio.open_connectionreturn_value{}.FakeStreamReader.read)   OKAYs   0000r   side_effectserial)r   r   r   format__name__assertIsNoner   devicer   s    r   test_device_returns_nonez(TestClientAsync.test_device_returns_none   s     2BRBTVfVhAij 	F7>>xHVmn F!!(:(:8(D"DEF	F 	F"DF F	F 	FF    B##B*B/B	0B8B 	B#	BB	BB B#c                 J  K   t        dt               t               f      5  t        dj                  t              g d      5  | j                  | j                  j                  d       d {          d d d        d d d        y 7 # 1 sw Y   xY w# 1 sw Y   y xY ww)Nr   r   r   )r   s   000bs   serial testr   r    )r   r   r   r!   r"   assertIsNotNoner   r$   r   s    r   test_devicezTestClientAsync.test_device!   s     2BRBTVfVhAij 	I7>>xHVxy I$$4;;+=+=h+G%GHI	I 	I%GI I	I 	Ir&   N)r"   
__module____qualname__r   r   r   r%   r)    r   r   r
   r
      sG    $ 2 2 F F
 I Ir   r
   __main__)__doc__asynciosysunittestpathinsertppadb.client_asyncr   async_wrapperr   patchersr   r   r   TestCaser
   r"   mainr,   r   r   <module>r9      sa   
  
  4  * " E EIh'' I, zHMMO r   