o
    tPf(                     @   sD  d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dl	mZ d dlmZ d dlmZ d dlmZ G d	d
 d
eZe Zddgdg ddededee
jr_dndedeiZg ddgdZh dZdgZg Zejdred dZdd ZG dd  d eZd!d" Z e   e!d#kre"  dS dS )$    )print_function)absolute_importN)six)modules)PLATFORM_SPECIFIC_SUFFIXES)debug)MAPPINGc                   @   s   e Zd Zdd ZdS )ANYc                 C   s   dS )NT )selfitemr
   r
   Y/var/www/html/humari/django-venv/lib/python3.10/site-packages/gevent/tests/test__all__.py__contains__   s   zANY.__contains__N)__name__
__module____qualname__r   r
   r
   r
   r   r	      s    r	   socketCAPIthread)allocateexit_threadinterrupt_main	start_newselectos	threading__builtin__builtinssignal)create_connectionRAND_addRAND_egdRAND_status_posixsubprocess)r   
subprocess>   gevent._ffigevent._utilgevent._tblibgevent._compatgevent._patchergevent._corecffigevent.threadinggevent._socketcommongevent._fileobjectposixgevent._fileobjectcommongevent.resolver._addressesgevent.resolver._hostsfilezgevent._queuewinzgevent.signalz<marker object>c                    s   t   fdd}|S )Nc                    s"   | j s| d| j   |  d S )NzNeed stdlib counterpart to %s)stdlib_moduleskipTestmodnamer   fr
   r   mT   s   z(skip_if_no_stdlib_counterpart.<locals>.m)	functoolswraps)r7   r8   r
   r6   r   skip_if_no_stdlib_counterpartS   s   r;   c                   @   s   e Zd ZdZdZdZdZdZedd Z	dd Z
dd Zd	d
 Zdd Zedd Zedd Zedd Zedd Zedd ZdS )AbstractTestMixinNFc              	      sH   j }|trtd| t - tdt zt	
| _W n ty8   |tjv r7d| }t| w W d    n1 sCw   Y  t jdd  _t jdg  _t jdg  _t| _ jd urzt j _W n
 ty}   Y d S w d _t jdd  _ jd u rd	 _ fd
dt jD  _d S d S d S )NzModule %s is platform specificignorezUnable to import %s__implements____imports____extensions__T__all__Fc                    s.   g | ]}| d stt j|tjs|qS )_)
startswith
isinstancegetattrr2   types
ModuleType).0nameclsr
   r   
<listcomp>   s    z0AbstractTestMixin.setUpClass.<locals>.<listcomp>)r4   endswithr   unittestSkipTestwarningscatch_warningssimplefilterDeprecationWarning	importlibimport_modulemoduleImportErrorr   OPTIONAL_MODULESrE   r>   r?   r@   r   getstdlib_name
__import__r2   stdlib_has_all
stdlib_alldir)rK   r4   msgr
   rJ   r   
setUpClassc   sD   







zAbstractTestMixin.setUpClassc                 C   s2   t | jds| | jt | d| j  d S d S )NrA   z%s Needs __all__)hasattrrV   assertInr4   NO_ALLr3   r5   r
   r
   r   skipIfNoAll   s   zAbstractTestMixin.skipIfNoAllc                 C   sd   |    i }td| j | |dd  d | _| t|t| jj	 | t
|t
| jj	 d S )Nzfrom %s import *__builtins__)rd   r   exec_r4   popmaxDiffassertEqualsetrV   rA   sorted)r   namesr
   r
   r   test_all   s   zAbstractTestMixin.test_allc                 C   sv   |    t| jp	dt| jpd t| jpd }z| t|t| jj W d S  t	y:   | 
d| j  Y d S w )Nr
   z'Module %s fails the all formula; fix it)rd   tupler>   r?   r@   ri   rk   rV   rA   AssertionErrorr3   r4   )r   all_calculatedr
   r
   r   test_all_formula   s   


z"AbstractTestMixin.test_all_formulac                 C   sF   | j tv rd S | jd ur| jd u r!td| j | j| j| jf d S d S )NzL%s (%r) has __implements__ (%s) but no stdlib counterpart module exists (%s))r4   ALLOW_IMPLEMENTSr>   r2   ro   rV   rZ   r5   r
   r
   r   "test_implements_presence_justified   s   
z4AbstractTestMixin.test_implements_presence_justifiedc                 C   sf   t | jpdt | j D ]$}|| jv rq|t| jdv rq|t| jv r&qt	d|| j| jf d S )Nr
   z,%r is not found in %r.__all__ nor in dir(%r))
rn   r>   r?   r]   COULD_BE_MISSINGrY   rZ   r^   r2   ro   r   rI   r
   r
   r   $test_implements_subset_of_stdlib_all   s   
z6AbstractTestMixin.test_implements_subset_of_stdlib_allc              	   C   sb   | j pdD ])}t| j|}zt| j|}| || W q ty.   |t| jg vr, Y qw d S )Nr
   )	r>   rE   rV   r2   assertIsNotAttributeErrorrt   rY   rZ   r   rI   r   stdlib_itemr
   r
   r   #test_implements_actually_implements   s   z5AbstractTestMixin.test_implements_actually_implementsc                 C   s4   | j D ]}t| j|}t| j|}| || qd S )N)r?   rE   rV   r2   assertIsry   r
   r
   r   test_imports_actually_imports   s
   
z/AbstractTestMixin.test_imports_actually_importsc                 C   s<   | j tv rd S | jD ]}t| j|rtd|| jf q
d S )Nz+'%r' is not an extension, it is found in %r)r4   EXTRA_EXTENSIONSr@   ra   r2   ro   ru   r
   r
   r   test_extensions_actually_extend   s   

z1AbstractTestMixin.test_extensions_actually_extendc                 C   s   g }| j D ]}|t| jdg vr|| q| js-|d d  D ]}t| j|r,|| qt| j	}|d ur\g }|D ]}||v rTt| j|t
t
u rStd| j|f  q;|| q;|}|r{| jrnd| j| j|f }t|d| j| j|f }t|d S )NrA   zIncompleteImplWarning: %s.%szXThe following items
              in %r.__all__
are missing from %r:
                 %rzQThe following items
          in dir(%r)
are missing from %r:
                 %r)r]   rE   rV   appendr\   ra   removeNOT_IMPLEMENTEDrY   rZ   _MISSINGr   r4   r2   ro   )r   missedrI   not_implementedresultr_   r
   r
   r   test_completeness   s>   


	z#AbstractTestMixin.test_completeness)r   r   r   r4   r\   r]   rZ   r2   classmethodr`   rd   rm   rq   rs   r;   rv   r{   r}   r   r   r
   r
   r
   r   r<   \   s,    
'




r<   c                  C   sb   t jddddD ]&\} }|trq|}|dd}td| ttjft	|d}|t
 |j	< qd S )NFT)
include_so	recursivecheck_optional.rB   Test_)r   r4   )r   walk_modulesrM   r   replacetyper<   rN   TestCaser   globals)rB   r4   orig_modnamemodname_no_periodrK   r
   r
   r   _create_tests  s    
r   __main__)#
__future__r   r   r9   sysrN   rF   rT   rP   gevent.testingr   r   gevent.testing.sysinfor   gevent.testing.utilr   gevent._patcherr   objectr	   PY2r   rt   rc   rr   r~   platformrC   r   r   r;   r<   r   r   mainr
   r
   r
   r   <module>   sR   
	 <