
    tni                     4    d Z ddlZddlZ G d d          ZdS )z:Tests for runpod.endpoint.asyncio.__init__ module exports.    Nc                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestEndpointAsyncioInitz4Test runpod.endpoint.asyncio module __all__ exports.c                     t          t          j        j        d          sJ t	          t          j        j        j        t                    sJ t          t          j        j        j                  dk    sJ dS )z+Test that __all__ is defined in the module.__all__r   N)hasattrrunpodendpointasyncio
isinstancer   listlen)selfs    b/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/tests/test_endpoint/test_asyncio_init.pytest_all_definedz(TestEndpointAsyncioInit.test_all_defined
   sb    v.	:::::&/194@@@@@6?*233a777777    c                     t           j        j        j        D ]/}t	          t           j        j        |          sJ d| d            0dS )z9Test that all symbols in __all__ are actually importable.zSymbol 'z$' in __all__ but not found in moduleN)r   r	   r
   r   r   )r   symbols     r   test_all_symbols_importablez3TestEndpointAsyncioInit.test_all_symbols_importable   sY    o-5 	u 	uF6?2F;;tt=t=t=t=ttttt	u 	ur   c                     ddh}t          t          j        j        j                  }||k    sJ d| d|             dS )z1Test that expected public symbols are in __all__.EndpointJob	Expected , got N)setr   r	   r
   r   )r   expected_symbolsactual_symbolss      r   test_expected_public_symbolsz4TestEndpointAsyncioInit.test_expected_public_symbols   s[     
 V_4<==>1113g?O3g3gWe3g3g11111r   c                     ddg}|D ]p}|t           j        j        j        v sJ t	          t           j        j        |          sJ t          j        t          t           j        j        |                    sJ qdS )z:Test that endpoint classes are accessible and are classes.r   r   N)r   r	   r
   r   r   inspectisclassgetattr)r   endpoint_classes
class_names      r    test_endpoint_classes_accessiblez8TestEndpointAsyncioInit.test_endpoint_classes_accessible   s    &.* 	Q 	QJ!8!@@@@@6?2J??????76?+BJ#O#OPPPPPP	Q 	Qr   c                    ddl }|j        j        j        |j        j        k    sJ |j        j        j        |j        j        k    sJ |j        j        j        |j        j        k    sJ |j        j        j        |j        j        k    sJ dS )zGTest that asyncio classes are different from the main endpoint classes.r   N)runpod.endpointr	   r
   r   AsyncioEndpointr   
AsyncioJob)r   r   s     r   5test_asyncio_classes_are_different_from_parent_modulezMTestEndpointAsyncioInit.test_asyncio_classes_are_different_from_parent_module'   s     	 &/6?3RRRRR&*fo.HHHHH &/6?3KKKKK&*fo.AAAAAAAr   c                     t           j        j        j        t	                    }t                    t          |          k    sJ dfdD                          dS )z0Test that __all__ contains no duplicate symbols.zDuplicates found in __all__: c                 F    g | ]}                     |          d k    |S )   )count).0xall_symbolss     r   
<listcomp>zLTestEndpointAsyncioInit.test_no_duplicate_symbols_in_all.<locals>.<listcomp>8   sn      YM  YM  YM_`s~  tE  tE  FG  tH  tH  KL  tL  tLYZ  tL  tL  tLr   N)r   r	   r
   r   r   r   )r   unique_symbolsr0   s     @r    test_no_duplicate_symbols_in_allz8TestEndpointAsyncioInit.test_no_duplicate_symbols_in_all4   s    o-5[));3~#6#6666  9O  YM  YM  YM  YMdo  YM  YM  YM  9O  9O66666r   c                 @   d t          t          j        j                  D             }t	                      }||z
  }t	          t          j        j        j                  }|                    |          sJ d||z
               ddh}||k    sJ d| d|             dS )z8Test that __all__ contains only the intended public API.c                 <    h | ]}|                     d           |S )_)
startswith)r.   names     r   	<setcomp>zJTestEndpointAsyncioInit.test_all_covers_public_api_only.<locals>.<setcomp>=   s8     4 4 4"ooc224 4 4 4r   z%__all__ contains non-public symbols: r   r   r   r   N)dirr   r	   r
   r   r   issubset)r   module_attrsexpected_private_attrspublic_attrsr0   expected_public_apis         r   test_all_covers_public_api_onlyz7TestEndpointAsyncioInit.test_all_covers_public_api_only:   s    4 4V_-D)E)E 4 4 4 "%#&<<&/19:: ##L11ww3w[fiu[u3w3wwww  *5111113g?R3g3gZe3g3g11111r   N)__name__
__module____qualname____doc__r   r   r   r$   r)   r3   r@    r   r   r   r      s        >>8 8 8u u u
h h hQ Q QB B BO O Oh h h h hr   r   )rD   r   runpod.endpoint.asyncior   r   rE   r   r   <module>rG      sf    @ @     Dh Dh Dh Dh Dh Dh Dh Dh Dh Dhr   