o
    7?e	                  
   @   s   d dl Z d dlZd dlmZ G dd dZejdddgddggdd	 Zejd
ee	dgdd Z
ejdddgde jgedgee jge	dge	e jggdd ZdS )    N)detect_console_encodingc                       s:   e Zd ZdZd
 fddZedd Zedd	 Z  Z	S )MockEncodingz
    Used to add a side effect when accessing the 'encoding' property. If the
    side effect is a str in nature, the value will be returned. Otherwise, the
    side effect should be an exception that will be raised.
    returnNc                    s   t    || _d S N)super__init__val)selfencoding	__class__ e/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/pandas/tests/io/formats/test_console.pyr      s   

zMockEncoding.__init__c                 C   s   |  | jS r   )raise_or_returnr   )r	   r   r   r   r
      s   zMockEncoding.encodingc                 C   s   t | tr| S | r   )
isinstancestr)r   r   r   r   r      s   
zMockEncoding.raise_or_return)r   N)
__name__
__module____qualname____doc__r   propertyr
   staticmethodr   __classcell__r   r   r   r   r      s    
r   zempty,filledstdinstdoutc                 C   sh   |   &}|d| td |d| t| t |ks"J W d    d S 1 s-w   Y  d S )Nzsys. contextsetattrr   r   )monkeypatchemptyZfilledr   r   r   r   .test_detect_console_encoding_from_stdout_stdin   s
   
"r!   r
   asciic                 C   s\   |    }|ddd  |dt| t dksJ W d    d S 1 s'w   Y  d S )Nlocale.getpreferredencodingc                   S      dS )Nfoor   r   r   r   r   <lambda>.       zAtest_detect_console_encoding_fallback_to_locale.<locals>.<lambda>
sys.stdoutr%   r   )r   r
   r   r   r   r   /test_detect_console_encoding_fallback_to_locale*   s
   
"r)   z
std,localec                    sp   |   *}|d fdd |dt| |ddd  t dks&J W d    d S 1 s1w   Y  d S )Nr#   c                      s
   t  S r   )r   r   r   localer   r   r&   D   s   
 zBtest_detect_console_encoding_fallback_to_default.<locals>.<lambda>r(   zsys.getdefaultencodingc                   S   r$   )NsysDefaultEncodingr   r   r   r   r   r&   G   r'   r,   r   )r   Zstdr+   r   r   r*   r   0test_detect_console_encoding_fallback_to_default3   s   
"r-   )r+   ZpytestZpandas._configr   r   markZparametrizer!   AttributeErrorOSErrorr)   Errorr-   r   r   r   r   <module>   s&    


