o
    Zh                     @   s  d dl Z d dlZd dlZd dlZd dlZd dlmZ dd Zej	
ddd Zdd	 Zd
d Zdd Zdd Zdd Zdd Zej	j
ejdkdddd Zej	dg ejejejejejejejejejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7ej8ej9ej:ej;ej<ej=ej>ej?ej@ejAejBejCejDejEejFejGejHejIejJejKejLejMejNejOejPejQejRejSejTejUejVejWejXejYejZej[ej\ej]ej^ej_ej`ejaejbejcejdejeejfejgejhejiejjejkejljmejljnejoejpejqdd ZrdS )    N)ArrowInvalidc                  C   s(   t  } tjtj| ddsJ d S )Narrowzapi.h)paZget_includeospathexistsjoin)Zinclude_dir r	   N/var/www/html/lang_env/lib/python3.10/site-packages/pyarrow/tests/test_misc.pytest_get_include   s    r   zsys.platform != "win32"c                   C   s   t dd t D sJ d S )Nc                 s   s&    | ]}t jt j|d V  qdS )z	arrow.libN)r   r   r   r   ).0	directoryr	   r	   r
   	<genexpr>#   s    z.test_get_library_dirs_win32.<locals>.<genexpr>)anyr   Zget_library_dirsr	   r	   r	   r
   test_get_library_dirs_win32!   s   r   c               	   C   T   t  } | dks
J zt | d  t  | d ksJ W t |  d S t |  w Nr      )r   	cpu_countZset_cpu_countnr	   r	   r
   test_cpu_count'      r   c               	   C   r   r   )r   Zio_thread_countZset_io_thread_countr   r	   r	   r
   test_io_thread_count1   r   r   c                     sr   d  fdd} | d\}}|  dksJ |dksJ dD ]}| |\}}|  dks.J d|  v s6J qd S )	NzOif 1:
        import pyarrow as pa
        print(pa.io_thread_count())
        c                    sF   t j }| |d< tjtjd g|dd}|  |j	 |j
	 fS )NZARROW_IO_THREADS-cT)envcapture_output)r   environcopy
subprocessrunsys
executablecheck_returncodestdoutdecodestderr)env_varr   rescoder	   r
   run_with_env_varC   s   
z6test_env_var_io_thread_count.<locals>.run_with_env_varZ17 )z-1z8z;ARROW_IO_THREADS does not contain a valid number of threads)strip)r+   outerrvr	   r)   r
   test_env_var_io_thread_count;   s   
r3   c                   C   sj   t tjtjs	J t tjtjsJ t tjtsJ t tjts"J tjj	tjks+J tjj
dv s3J d S )N)debugreleaseZ
minsizerelZrelwithdebinfo)
isinstancer   Zcpp_build_infoZ	BuildInfoZcpp_version_infoVersionInfoZcpp_versionstr__version__version_infoZ
build_typer	   r	   r	   r
   test_build_infoV   s   r;   c                  C   s   t  } t| t jsJ d}| j|v sJ | j|v sJ | jdkr>tj }d|d< d| jd}t	j
tjd|g|d d S d S )N)noneZsse4_2ZavxZavx2Zavx512r<   ZARROW_USER_SIMD_LEVELzif 1:
            import pyarrow as pa

            info = pa.runtime_info()
            assert info.simd_level == 'none', info.simd_level
            assert info.detected_simd_level == z6,                info.detected_simd_level
            r   )r   )r   Zruntime_infor6   ZRuntimeInfoZ
simd_levelZdetected_simd_levelr   r   r   r   
check_callr!   r"   )infoZpossible_simd_levelsr   r*   r	   r	   r
   test_runtime_infoc   s   

r?   c                  C   s   d} t tjd| g d S )Nzif 1:
        import atexit

        def import_arrow():
            import pyarrow

        atexit.register(import_arrow)
        r   )r   r=   r!   r"   r)   r	   r	   r
   test_import_at_shutdownx   s   r@   win32zFPath to timezone database is not configurable on non-Windows platforms)reasonc                   C   s>   t jtdd td W d    d S 1 sw   Y  d S )Nz9Arrow was set to use OS timezone database at compile timematchr   )pytestraisesr   r   Zset_timezone_db_pathr	   r	   r	   r
   %test_set_timezone_db_path_non_windows   s
   "rG   klassc                 C   sH   d}t jt|j| jdd |   W d    d S 1 sw   Y  d S )Nz9Do not call {cls}'s constructor directly, use .* instead.)clsrC   )rE   rF   	TypeErrorformat__name__)rH   msgr	   r	   r
   &test_extension_type_constructor_errors   s   `"rN   )sr   r   r!   rE   Zpyarrowr   Zpyarrow.libr   r   markZskipifr   r   r   r3   r;   r?   r@   platformrG   ZparametrizeFieldZSchemaZChunkedArrayZRecordBatchTableBufferZArrayZTensorZDataTypeZListTypeZLargeListTypeZFixedSizeListType	UnionTypeZSparseUnionTypeZDenseUnionTypeZ
StructTypeZ
Time32TypeZ
Time64TypeZTimestampTypeZDecimal128TypeZDecimal256TypeZDictionaryTypeZFixedSizeBinaryTypeZ	NullArrayZNumericArrayZIntegerArrayZFloatingPointArrayZBooleanArrayZ	Int8ArrayZ
Int16ArrayZ
Int32ArrayZ
Int64ArrayZ
UInt8ArrayZUInt16ArrayZUInt32ArrayZUInt64ArrayZ	ListArrayZLargeListArrayZMapArrayZFixedSizeListArrayZ
UnionArrayZBinaryArrayZStringArrayZFixedSizeBinaryArrayZDictionaryArrayZDate32ArrayZDate64ArrayZTimestampArrayZTime32ArrayZTime64ArrayZDurationArrayZDecimal128ArrayZDecimal256ArrayZStructArrayZRunEndEncodedArrayZScalarZBooleanScalarZ
Int8ScalarZInt16ScalarZInt32ScalarZInt64ScalarZUInt8ScalarZUInt16ScalarZUInt32ScalarZUInt64ScalarZHalfFloatScalarZFloatScalarZDoubleScalarZDecimal128ScalarZDecimal256ScalarZDate32ScalarZDate64ScalarZTime32ScalarZTime64ScalarZTimestampScalarZDurationScalarZStringScalarZBinaryScalarZFixedSizeBinaryScalarZ
ListScalarZLargeListScalarZ	MapScalarZFixedSizeListScalarZUnionScalarZStructScalarZDictionaryScalarZRunEndEncodedScalarZipcMessageZMessageReaderZ
MemoryPoolZLoggingMemoryPoolZProxyMemoryPoolrN   r	   r	   r	   r
   <module>   s  





	
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\^