
    i                        d dl Zd dlZd dlmZ d dlZd dlmZ	 d dl
mZ ej                  j                  dddgddg	      d
        Zej                  j                  dddgddg	      d        Zej                  j                  dddgddg	      d        Zej                  j                  dddgddg	      d        Zd Zej                  j                  dg d      ej                  j                  dddgddg	      d               Zej                  j                  dg d      ej                  j                  dddgddg	      d               Zej                  j                  dddgddg	      d        Zd Zd Zej                  j1                  e d      ej                  j                  dddg      d               Zy)    N)np_version_gt2)FloatingArrayboxTFseriesarray)idsc                    | rt         j                  nt         j                  } |g dd      }|j                         }t	        j                  g dd      }t        j                  ||        |g dd      }|j                         }|r)t	        j                  ddt        j                  gd      }n,t	        j                  ddt         j                  gt              }t        j                  ||       y )N皙?皙?333333?Float64dtypefloat64r   r   Nr   r   )
pdSeriesr   to_numpynptmassert_numpy_array_equalnanNAobject)r   using_nan_is_naconarrresultexpecteds         g/app/cer_product_mecsu/.venv/lib/python3.12/site-packages/pandas/tests/arrays/floating/test_to_numpy.pytest_to_numpyr"      s    "))C oY
/C\\^Fxxy9H 1
i
0C\\^F88S#rvv.i@88S#ruu-V<1    c                 X   | rt         j                  nt         j                  } |g dd      }|j                  d      }t	        j                  g dd      }t        j                  ||        |g dd      }|j                  d      }t	        j                  ddt        j                  gd      }t        j                  ||       |j                  dt        j                        }t	        j                  ddt        j                  gd      }t        j                  ||       y )	Nr
   r   r   r   r   r   r   r   na_value)r   r   r   r   r   r   r   r   r   r   r   r   r    s        r!   test_to_numpy_floatr(       s    "))C oY
/C\\	\*Fxxy9H1
i
0C\\	\*Fxxc266*)<H1\\	BFF\;Fxxc266*)<H1r#   c                    | rt         j                  nt         j                  } |g dd      }|j                  d      }t	        j                  g dd      }t        j                  ||        |g dd      }t        j                  t        d      5  |j                  d      }d d d         |g d	d      }|j                  d      }t	        j                  g d
d      }t        j                  ||       y # 1 sw Y   WxY w)N)      ?       @g      @r   r   int64)         )r*   r+   Nzcannot convert to 'int64'-dtypematch)r   g?g?)r   r   r-   )
r   r   r   r   r   r   r   pytestraises
ValueErrorr'   s        r!   test_to_numpy_intr5   4   s    "))C oY
/C\\\(Fxx	1H1
i
0C	z)J	K -G,- oY
/C\\\(Fxx	1H1- -s   D  D	c                    | rt         j                  nt         j                  } |g dd      }|j                  t        d       }t        j                  g dd      }t        j                  ||       |j                  t        d      }t        j                  g dd      }t        j                  ||       |j                  d	d
      }t        j                  g dd	      }t        j                  ||       y )N        r*   Nr   r   r%   r   F)FTFboolr,   )r   r-   r:   )	r   r   r   r   r   r   r   r   r9   r'   s        r!   test_to_numpy_na_valuer;   I   s    "))C
i
0C\\\6Fxx(9H1\\u\5Fxx,F;H1\\#\6Fxx73H1r#   c                 z   t        j                  g d      }| rd|d<   t        t        j                  dt         j                  dg      |      }|j	                  dd      }| rt        j                  g dd	      }n(t        j                  dt         j                  d
gd	      }t        j                  ||       y )N)FFTTr-   r8   r   r%   )r8         r>   r   r>   )r   r   r   r   r   r   r   )r   maskr   r   r    s        r!   test_to_numpy_na_value_with_nanr@   [   s    88()DQ
#rvvs!34d
;C\\	B\7F88-Y?88S"&&$/yA1r#   r   )r   float32int32r,   r9   c                     | rt         j                  nt         j                  } |ddgd      }|j                  |      }t	        j                  ddg|      }t        j                  ||       y )Nr8   r*   r   r   r   r-   )r   r   r   r   r   r   r   r   r   r   r   r   r    s         r!   test_to_numpy_dtyperE   j   sY     "))C
sCj	
*C\\\&FxxAe,H1r#   )rB   r,   r9   c                     | rt         j                  nt         j                  } |g dd      }t        j                  t
        |      5  |j                  |       d d d        y # 1 sw Y   y xY w)Nr7   r   r   r0   )r   r   r   r2   r3   r4   r   )r   r   r   r   s       r!   test_to_numpy_na_raisesrG   u   sS     "))C
i
0C	z	/ "5!" " "s   
A&&A/c                 "   | rt         j                  nt         j                  } |g dd      }|j                  d      }t	        j                  ddt         j
                  gt        j                   d      }t        j                  ||       y )Nr7   r   r   strr8   r*   U32)	r   r   r   r   r   r   r   ENDIANr   rD   s         r!   test_to_numpy_stringrL   ~   sf    "))C
i
0C\\\&Fxxc255)BII;c1BCH1r#   c                  z   t        j                  g dd      } | j                  d      }d|d<   t        j                  | t        j                  g dd             t        j                  g dd      } | j                  dd	      }d|d<   t        j                  | t        j                  g dd             y )
Nr
   r   r   r   
   r   )rN   r   r   Tr   copy)r   r   r   r   assert_extension_array_equalr   r   s     r!   test_to_numpy_copyrS      s    
((?)
4C\\	\*FF1I##C.	)RS
((?)
4C\\	\5FF1I##C/)STr#   c                     t        j                  g dd      } d| _        | j                  d      }|j                  j
                  rJ | j                  dd      }|j                  j
                  sJ | j                  d      }|j                  j
                  sJ | j                  d      }|j                  j
                  sJ y )	Nr
   r   r   Tr   rO   rA   r   )r   r   	_readonlyr   flags	writeablerR   s     r!   test_to_numpy_readonlyrX      s    
((?)
4CCM\\	\*F||%%%%\\	\5F<<!!!!\\	\*F<<!!!!\\\)F<<!!!!r#   z!copy keyword introduced in np 2.0)reasonr   c                 b   t        j                  g dd      }d|_        t        j                  ||       }|j
                  j                  rJ t        j                  || d      }|j
                  j                  sJ t        j                  || d      }|j
                  j                  rJ y )Nr
   r   r   TrO   F)r   r   rU   r   asarrayrV   rW   )r   r   r   s      r!   test_asarray_readonlyr\      s     ((?)
4CCMZZ5)F||%%%%ZZ5t4F<<!!!!ZZ5u5F||%%%%%r#   )numpyr   r2   pandas.compat.numpyr   pandasr   pandas._testing_testingr   pandas.core.arraysr   markparametrizer"   r(   r5   r;   r@   rE   rG   rL   rS   rX   skipifr\    r#   r!   <module>rg      s     .   , uHg3FG2 H2( uHg3FG2 H2& uHg3FG2 H2( uHg3FG2 H2"2 "RSuHg3FG2 H T2 "<=uHg3FG" H >" uHg3FG2 H2
U"  &/RS4"34& 5 T&r#   