U
    g-                     @   s4   d dl Z ddlmZ ddlmZ G dd deZdS )    N   )InfoExtractor   )ExtractorErrorc                   @   s    e Zd ZdZdZdZdd ZdS )	TestURLIEz8 Allows addressing of the test cases as test:yout.*be_1 Fz6test(?:url)?:(?P<extractor>.*?)(?:_(?P<num>\d+|all))?$c              	      s  ddl m} |dd\}s2dd|dS tjtjdfd	d
| D }t|dkrxtddddnlt|dkrt	fdd|D d pt	fdd|D d   std
ddd |D ddn|d  t d}|dkr" fdd
|D | j dS z|t|p0d }W n: tk
rr   td|pVd dt| dddY nX d|d   |d  S )Nr   )gen_extractor_classes	extractornumz:test )idtitleurl)flagsc                    s   g | ]}  |jr|qS  )searchIE_NAME).0e)rexr   </tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/testurl.py
<listcomp>   s      z+TestURLIE._real_extract.<locals>.<listcomp>r   zNo extractors matching z foundT)expectedc                 3   s$   | ]}|j    kr|V  qd S N)r   lowerr   Zieextractor_idr   r   	<genexpr>   s     z*TestURLIE._real_extract.<locals>.<genexpr>c                 3   s.   | ]&}|j d d    kr|V  qdS )+r   N)r   splitr   r   r   r   r   r      s     z&Found multiple matching extractors: {} c                 s   s   | ]}|j V  qd S r   )r   r   r   r   r   r   !   s     allc                    s   g | ]} |d   qS )r   )
url_result)r   tc)r   selfr   r   r   )   s     z testsz
Test case z not found, got only z
Test URL: r   )r
   r   Z_match_valid_urlgrouprecompile
IGNORECASElenr   nextformatjointupleZget_testcasesZplaylist_resultr   int
IndexErrorZ	to_screenr"   )r$   r   r   r	   Zmatching_extractorsZ	testcasesr#   r   )r   r   r   r$   r   _real_extract   sT    
 
 zTestURLIE._real_extractN)__name__
__module____qualname____doc__ZIE_DESCZ
_VALID_URLr0   r   r   r   r   r      s   r   )r&   commonr   utilsr   r   r   r   r   r   <module>   s   