o
    h                     @   sx  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ej	jdd Zdd Zdd Zej	j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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jlejmejnejoejpejqejrejsejtejuejvejwejxjyejxjz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dd ZdS )    N)ArrowInvalidc                  C   s(   t  } tjtj| ddsJ d S )Narrowzapi.h)paget_includeospathexistsjoin)include_dir r   K/var/www/vscode/kcb/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   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_countset_cpu_countnr   r   r   test_cpu_count'      r   c               	   C   r   r   )r   io_thread_count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 )N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_varD   s   
z6test_env_var_io_thread_count.<locals>.run_with_env_var17 )z-1z8z;ARROW_IO_THREADS does not contain a valid number of threads)strip)r2   outerrvr   r0   r   test_env_var_io_thread_count;   s   
r;   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release
minsizerelrelwithdebinfo)
isinstancer   cpp_build_info	BuildInfocpp_version_infoVersionInfocpp_versionstr__version__version_info
build_typer   r   r   r   test_build_infoW   s   rJ   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)nonesse4_2avxavx2avx512rK   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   runtime_infor@   RuntimeInfo
simd_leveldetected_simd_levelr   r$   r%   r&   
check_callr(   r)   )infopossible_simd_levelsr"   r1   r   r   r   test_runtime_infod   s   

rX   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&   rU   r(   r)   r0   r   r   r   test_import_at_shutdowny   s   rY   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   set_timezone_db_pathr   r   r   r   %test_set_timezone_db_path_non_windows   s
   "ra   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.)clsr\   )r^   r_   	TypeErrorformat__name__)rb   msgr   r   r   &test_extension_type_constructor_errors   s   v"rh   )r   r&   r(   r^   pyarrowr   pyarrow.libr   r   markskipifr   r   r   	processesr;   rJ   rX   rY   platformra   parametrizeFieldSchemaChunkedArrayRecordBatchTableBufferArrayTensorDataTypeListTypeLargeListTypeFixedSizeListTypeListViewTypeLargeListViewType	UnionTypeSparseUnionTypeDenseUnionType
StructType
Time32Type
Time64TypeTimestampTypeDecimal32TypeDecimal64TypeDecimal128TypeDecimal256TypeDictionaryTypeFixedSizeBinaryType	NullArrayNumericArrayIntegerArrayFloatingPointArrayBooleanArray	Int8Array
Int16Array
Int32Array
Int64Array
UInt8ArrayUInt16ArrayUInt32ArrayUInt64Array	ListArrayLargeListArrayMapArrayFixedSizeListArray
UnionArrayBinaryArrayStringArrayBinaryViewArrayStringViewArrayFixedSizeBinaryArrayDictionaryArrayDate32ArrayDate64ArrayTimestampArrayTime32ArrayTime64ArrayDurationArrayDecimal128ArrayDecimal256ArrayStructArrayRunEndEncodedArrayScalarBooleanScalar
Int8ScalarInt16ScalarInt32ScalarInt64ScalarUInt8ScalarUInt16ScalarUInt32ScalarUInt64ScalarHalfFloatScalarFloatScalarDoubleScalarDecimal128ScalarDecimal256ScalarDate32ScalarDate64ScalarTime32ScalarTime64ScalarTimestampScalarDurationScalarStringScalarBinaryScalarFixedSizeBinaryScalarBinaryViewScalarStringViewScalar
ListScalarLargeListScalarListViewScalarLargeListViewScalar	MapScalarFixedSizeListScalarUnionScalarStructScalarDictionaryScalarRunEndEncodedScalarRecordBatchReaderipcMessageMessageReader
MemoryPoolLoggingMemoryPoolProxyMemoryPoolDeviceMemoryManagerOpaqueArrayOpaqueScalar
OpaqueType
Bool8ArrayBool8Scalar	Bool8Type	JsonArray
JsonScalarJsonTyperh   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[\]^_`abcdefghijklmnopqrt