
    Owg	              
       r   d dl Z d dlZd dlmZ  G d d      Zej
                  j                  dddgddgg      d        Zej
                  j                  d	ee	d
g      d        Z
ej
                  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        Zy)    N)detect_console_encodingc                   D     e Zd ZdZd fdZed        Zed        Z x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.
    c                 0    t         |           || _        y N)super__init__val)selfencoding	__class__s     [/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/io/formats/test_console.pyr	   zMockEncoding.__init__   s        c                 8    | j                  | j                        S r   )raise_or_returnr
   )r   s    r   r   zMockEncoding.encoding   s    ##DHH--r   c                 *    t        | t              r| S | r   )
isinstancestr)r
   s    r   r   zMockEncoding.raise_or_return   s    c3JIr   )returnN)
__name__
__module____qualname____doc__r	   propertyr   staticmethodr   __classcell__)r   s   @r   r   r      s5     . .  r   r   zempty,filledstdinstdoutc                     | j                         5 }|j                  d| t        d             |j                  d| t        |             t               |k(  sJ 	 d d d        y # 1 sw Y   y xY w)Nzsys. contextsetattrr   r   )monkeypatchemptyfilledr"   s       r   .test_detect_console_encoding_from_stdout_stdinr'      sj    
 
			 3'$ugR(89$vhf)=>&(F2223 3 3s   AA''A0r   asciic                     | j                         5 }|j                  dd        |j                  dt        |             t               dk(  sJ 	 d d d        y # 1 sw Y   y xY w)Nlocale.getpreferredencodingc                       y)Nfoo r-   r   r   <lambda>zAtest_detect_console_encoding_fallback_to_locale.<locals>.<lambda>.       r   
sys.stdoutr,   r!   )r$   r   r"   s      r   /test_detect_console_encoding_fallback_to_localer1   *   sZ     
			 2'5}El8&<=&(E1112 2 2s   >AA"z
std,localec                     | j                         5 }|j                  dfd       |j                  dt        |             |j                  dd        t               dk(  sJ 	 d d d        y # 1 sw Y   y xY w)Nr*   c                  .    t         j                         S r   )r   r   )locales   r   r.   zBtest_detect_console_encoding_fallback_to_default.<locals>.<lambda>D   s    <3O3OPV3W r   r0   zsys.getdefaultencodingc                       y)NsysDefaultEncodingr-   r-   r   r   r.   zBtest_detect_console_encoding_fallback_to_default.<locals>.<lambda>G   r/   r   r6   r!   )r$   stdr4   r"   s     ` r   0test_detect_console_encoding_fallback_to_defaultr8   3   su     
			 A')+W	
 	l3&7802NO&(,@@@@A A As   AA//A8)r4   pytestpandas._configr   r   markparametrizer'   AttributeErrorOSErrorr1   Errorr8   r-   r   r   <module>r@      s      2 . 7H*='?R)ST3 U3 ngw%GH2 I2 	'	&,,	!	&	'	&,,

A

Ar   