o
    �¨Êhƒ	  ã                
   @   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__© úV/var/www/html/env/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ÚemptyÚ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   Ústdr,   r   r   r+   r   Ú0test_detect_console_encoding_fallback_to_default3   s   
ÿ"úr/   )r,   ÚpytestÚpandas._configr   r   ÚmarkÚparametrizer"   ÚAttributeErrorÚOSErrorr*   ÚErrorr/   r   r   r   r   Ú<module>   s&    


úþ