
    ei3[                     Z   d dl mZ d dlZd dlZd dlZ	 d dlZd dlZ	d dl
mc mZ d dlmZ 	 d dlZd Zd Zej(                  j                   d        Zej(                  j                   ej(                  j,                  d               Zd Zd	 Zd
 Zd Zd Zd Zej(                  j
                  d        Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d Z)d Z*d Z+d Z,d Z-d Z.d Z/d  Z0d! Z1ej(                  j                   d"        Z2d# Z3d$ Z4d% Z5y# e$ r dZY w xY w# e$ r Y w xY w)&    )OrderedDictN)Versionc                      d} t        j                  t        |       5  t        j                          d d d        y # 1 sw Y   y xY w)NzGDo not call Schema's constructor directly, use `pyarrow.schema` instead)match)pytestraises	TypeErrorpaSchema)msgs    [/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/pyarrow/tests/test_schema.pytest_schema_constructor_errorsr   &   s5    C	y	, 
		  s	   <Ac                  h    g d} | D ])  }t        t        |      } |       }t        |      |k(  r)J  y )N)int8int16int32int64uint8uint16uint32uint64)getattrr
   str)dtypesnamefactoryts       r   test_type_integersr   -   s=    5F  "d#I1v~~    c                     t        j                  d      } t        t        j                        t        d      k  rt        j                  d      } t        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                         t         j                  ft        j                          t         j                   ft        j"                         t         j"                  ft        j$                         t         j$                  ft        j&                         t         j&                  ft        j(                         | ft        j*                         | ft        j,                  d      | ft        j.                         t         j                  ft        j0                         t         j                  ft        j2                         t         j                  ft        j.                  d      t         j                  ft        j4                         t         j                  ft        j6                         t         j                  ft        j8                         t         j                  ft        j:                  t        j                               t         j                  ft        j<                  t        j                         t        j&                               t         j                  fg}|D ]  \  }}|j?                         |k(  rJ  y )Ndatetime64[ms]z2.0.0datetime64[ns]ms   ) npdtyper   pd__version__r
   nullobject_bool_r   r   r   r   r   r   r   r   float16float32float64date32date64	timestampbinarylarge_binarybinary_viewstringlarge_stringstring_viewlist_map_to_pandas_dtype)M8cases
arrow_type
numpy_types       r   test_type_to_pandas_dtyper?   7   sC   	"	#Br~~!11XX&'	BJJ	RXX	BGG	RXX	RXX	RXX	RXX	bii 	bii 	bii 	rzz"	rzz"	rzz"	b	b	d	R 	bjj!		BJJ'		2::&	2

#	bjj!		BJJ'		2::&	"'')	bjj)	RZZ\	*BJJ75E8 #( :
J))+z999:r   c                  .    t        j                  d       y )Nzarrow_7980.py)	test_utilinvoke_script r   r   &test_type_to_pandas_dtype_check_importrD   \   s     O,r   c                     t        j                         } t        j                  |       }t        |      dk(  sJ t        j                  dt        j
                               }t        j                  |      }t        |      dk(  sJ y )Nzlist<item: int32>my_itemzlist<my_item: string>)r
   r   r8   r   fieldr5   )
value_type	list_typerG   l2s       r   test_type_listrK   c   sd    J$Iy>0000HHY		,E	%Br7----r   c                  z    t        j                         } | t        j                         k(  sJ | dk(  sJ | dk7  sJ y )Nr      )r
   r   )vals    r   test_type_comparisonsrO   m   s8    
((*C"((*'>>!8O8r   c                     g dt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fd	t        j
                         fd
t        j
                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                         fdt        j                  d      fdt        j                  d      fdt        j                   d      fd t        j                   d!      fd"t        j"                  d      fd#t        j"                  d      fd$t        j"                  d      fd%t        j"                  d!      fd&t        j$                  d      fd't        j$                  d      fd(t        j$                  d      fd)t        j$                  d!      fd*t        j&                         f} | D ]  \  }}t        j(                  |      |k(  rJ  y )+Ni1r   i2r   i4r   i8r   u1r   u2r   u4r   u8r   f4r-   f8r.   r/   r0   r5   r   r2   	time32[s]sz
time32[ms]r#   z
time64[us]us
time64[ns]nsztimestamp[s]ztimestamp[ms]ztimestamp[us]ztimestamp[ns]zduration[s]zduration[ms]zduration[us]zduration[ns]month_day_nano_interval)r
   r   r   r   r   r   r   r   r   r-   r.   r/   r0   r5   r2   time32time64r1   durationr`   type_for_alias)r<   rN   expecteds      r   test_type_for_aliasrf   t   s   '	rwwy'	' 
rxxz' 
"((*	'
 
rxxz' 
"((*' 
rxxz' 
"((*' 
rxxz' 
"((*' 
ryy{' 
299;' 
ryy{' 
299;' 
ryy{'  
299;!'" 
rzz|#'$ 
BJJL!%'& 
rzz|''( 
BJJL!)'* 
299;+', 
299;-'. 
299;/'0 
		1'2 
299;3'4 
biin%5'6 
ryy'7'8 
ryy'9': 
ryy';'< 
c*+='> 
",,t,-?'@ 
",,t,-A'B 
",,t,-C'D 
C()E'F 
T*+G'H 
T*+I'J 
T*+K'L 
#B$>$>$@AM'ER  2X  %1112r   c                  L    t        j                         } t        |       dk(  sJ y )Nr5   )r
   r5   r   )r   s    r   test_type_stringrh      s    
		Aq6Xr   c                  z    d} t        j                  d|       }|j                  dk(  sJ |j                  | k(  sJ y )NzAmerica/Los_Angelesr_   )tz)r
   r1   unitrj   )rj   r   s     r   test_type_timestamp_with_tzrl      s7    	B
Tb!A66T>>442::r   c                     t        j                  d      } t        j                  d      }t        j                  d      }t        j                  d      }| j                  dk(  sJ |j                  dk(  sJ |j                  dk(  sJ |j                  dk(  sJ t	        |       dk(  sJ t	        |      dk(  sJ t        j                  t              5  t        j                  d       d d d        t        j                  t              5  t        j                  d       d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)Nr\   r#   r]   r_   r[   r^   )r
   ra   rb   rk   r   r   r   
ValueError)t1t2t3t4s       r   test_time_typesrs      s    	3B	4B	4B	4B77c>>77d??77d??77d??r7k!!!r7l"""	z	" 
		$ 
z	" 
		#   s   D(	D4(D14D=c                  	   t        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j
                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d	      t        j                         ft        j                  d
      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                         ft        j                  d      t        j                   d      ft        j                  d      t        j                   d      ft        j                  d      t        j                   d      ft        j                  d      t        j                   d      ft        j                  d      t        j"                  d      ft        j                  d      t        j"                  d      ft        j                  d      t        j"                  d      ft        j                  d      t        j"                  d      fg} | D ]!  \  }}t        j$                  |      }||k(  r!J  t        j$                  d      t        j                         k(  sJ t        j$                  t         j&                        t        j                         k(  sJ t        j$                  d      t        j                         k(  sJ t        j$                  t(              t        j                         k(  sJ t+        j,                  t.              5  t        j$                  t        j                  d             d d d        t+        j,                  t0              5  t        j$                  d       d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)Nboolr   r   r   r   r   r   r   r,   r-   r.   USzdatetime64[s]r\   r!   r#   zdatetime64[us]r]   r"   r_   ztimedelta64[s]ztimedelta64[ms]ztimedelta64[us]ztimedelta64[ns]Onot_convertible_to_dtype)r%   r&   r
   r+   r   r   r   r   r   r   r   r,   r-   r.   r5   r2   r1   rc   from_numpy_dtypestr_ru   r   r   NotImplementedErrorr	   )r<   dtptresults       r   test_from_numpy_dtyper      s-    
&	288:&	&	2779%	'	BHHJ'	'	BHHJ'	'	BHHJ'	'	BHHJ'	(	RYY[)	(	RYY[)	)	bjjl+	)	bjjl+	)	bjjl+	#		$	#		$	/	"BLL$56	"	#R\\$%78	"	#R\\$%78	"	#R\\$%78	"	#R[[%56	#	$bkk$&78	#	$bkk$&78	#	$bkk$&78+E0  B$$R(||
 s#ryy{222rww'299;666w'288:555t$
222	*	+ +
BHHSM*+ 
y	! 8
678 8+ +8 8s   )R=S	=S	Sc            	         t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|j                  g dk(  sJ |j                  t        j                         t        j                         t        j                  t        j
                               gk(  sJ t        |      dk(  sJ |d   j                  dk(  sJ |d   j                  | d   j                  k(  sJ |j                  d      j                  dk(  sJ |j                  d      j                  | d   j                  k(  sJ t        |      dk(  sJ t        j                  t              5  t        j                  d g       d d d        y # 1 sw Y   y xY w)Nfoobarbazr   r   r      r   Bfoo: int32
bar: string
baz: list<item: int8>
  child 0, item: int8)r
   rG   r   r5   r8   r   schemanamestypeslenr   typereprr   r   r	   fieldsschs     r   test_schemar      sw   

#
		$
+,F
 ))F
C99----99RYY["((27792EFFFFs8q==q6;;%q6;;&)..(((99U  E)))99U  F1INN2229     
y	! 
		4&  s   G++G4c            	         t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }t        j                  |      } |       J ~ |       J y )Nr   r   r   )	r
   rG   r   r5   r8   r   r   weakrefref)r   r   wrs      r   test_schema_weakrefr   	  s    

#
		$
+,F
 YYvF	V	B44<<r   c            
      n   d} t        j                  t        j                  dddddi      t        j                  dd	d
ddi      gd| i      }|j                         d| d d  dt	        |       dz
   k(  sJ t        j                  dgddi      j                         }|dk(  sJ |j                  d      d| d d  dt	        |       dz
   dk(  sJ |j                  ddd      d| d d  dt	        |       dz
   dk(  sJ |j                  dd      d k(  sJ |j                  ddd!      d"k(  sJ y )#Na  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan vel
turpis et mollis. Aliquam tincidunt arcu id tortor blandit blandit. Donec
eget leo quis lectus scelerisque varius. Class aptent taciti sociosqu ad
litora torquent per conubia nostra, per inceptos himenaeos. Praesent
faucibus, diam eu volutpat iaculis, tellus est porta ligula, a efficitur
turpis nulla facilisis quam. Aliquam vitae lorem erat. Proin a dolor ac libero
dignissim mollis vitae eu mauris. Quisque posuere tellus vitae massa
pellentesque sagittis. Aenean feugiat, diam ac dignissim fermentum, lorem
sapien commodo massa, vel volutpat orci nisi eu justo. Nulla non blandit
sapien. Quisque pretium vestibulum urna eu vehicula.r   r   Fkey1value1metadatar   r5   Tkey3value3loremzfoo: int32 not null
  -- field metadata --
  key1: 'value1'
bar: string
  -- field metadata --
  key3: 'value3'
-- schema metadata --
lorem: 'A   z' + )f0r   keyCvaluexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzjf0: int32
-- schema metadata --
key: 'valuexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')truncate_metadata\   z (... [   z chars omitted)2   )r   show_field_metadataelement_size_limitz>foo: int32 not null
bar: string
-- schema metadata --
lorem: '*   )   )r   show_schema_metadatazofoo: int32 not null
  -- field metadata --
  key1: 'value1'
bar: string
  -- field metadata --
  key3: 'value3')r   r   r   zfoo: int32 not null
bar: string)r
   r   rG   	to_stringr   )r   	my_schemar   s      r   #test_schema_to_string_with_metadatar     s   
8E 		288E7E.4h-?A88E8T.4h-?AB %,U#3	5I   )	 
sDUb)%- - - - YY(!&(: ;==FY[  & & & & 7 @	 
sF3u:?+?<> > > > 3824  6>	 
ws5zV45_	:HH H H 49  ;?   3849  ;?  r   c                  ~   dt        j                         fdt        j                         fdt        j                  t        j                               fg} t        j
                  |       }|j                  g dk(  sJ |j                  t        j                         t        j                         t        j                  t        j                               gk(  sJ t        |      dk(  sJ t        |      dk(  sJ t        j                  t              5  t        j
                  dg       d d d        y # 1 sw Y   y xY wNr   r   r   r   r   r   )r   N)r
   r   r5   r8   r   r   r   r   r   r   r   r   r	   r   s     r   test_schema_from_tuplesr   ^  s    	
				#$F
 ))F
C99----99RYY["((27792EFFFFs8q==9     
y	! #
		=/"# # #s   D33D<c            	         t        dt        j                         fdt        j                         fdt        j                  t        j
                               fg      } t        j                  |       }|j                  g dk(  sJ |j                  t        j                         t        j                         t        j                  t        j
                               gk(  sJ t        |      dk(  sJ t        |      dk(  sJ t        dg      } t        j                  t              5  t        j                  |        d d d        y # 1 sw Y   y xY wr   )r   r
   r   r5   r8   r   r   r   r   r   r   r   r   r	   r   s     r   test_schema_from_mappingr   r  s   	
				#$ F
 ))F
C99----99RYY["((27792EFFFFs8q==9     -)F	y	! 
		&  s   (EEc            	         t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|j                  g dk(  sJ |j                  t        j                         t        j                         t        j                  t        j
                               gk(  sJ t        |      dk(  sJ t        |      dk(  sJ |d   j                  dk(  sJ |d   j                  | d   j                  k(  sJ t        j                  t              5  |j!                  d      | d   k(  sJ 	 d d d        t        j                  t              5  |j!                  d      J 	 d d d        t        j                  t"        t        f      5  |j!                  d      J 	 d d d        |j%                  d      d	k(  sJ |j'                  d      dd
gk(  sJ y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   PxY w)Nr   r   )r   r   r   r   zBfoo: int32
bar: string
foo: list<item: int8>
  child 0, item: int8r      xxx   )r
   rG   r   r5   r8   r   r   r   r   r   r   r   r   r   warnsFutureWarningfield_by_nameUserWarningget_field_indexget_all_field_indicesr   s     r   test_schema_duplicate_fieldsr     s   

#
		$
+,F
 ))F
C99----99RYY["((27792EFFFFs8q==9     q6;;%q6;;&)..(((	m	$ 5  '6!94445	m	$ 0  '///0	{M2	3 0  '///0 u%+++ $$U+1v5555 50 00 0s$   >I:I6IIII#c                  L   t        j                  dt        j                               j                  ddi      } | j	                         | gk(  sJ t        j                  dt        j
                         d      }t        j                  dt        j                  | |g      d      }|j	                         t        j                  dt        j                               j                  ddi      t        j                  d	t        j
                         d      gk(  sJ t        j                  dt        j                  | |g            }|j	                         t        j                  dt        j                               j                  ddi      t        j                  d	t        j
                               gk(  sJ t        j                  d
t        j                  |g            }|j	                         t        j                  dt        j                  | |g            gk(  sJ y )Nr      foo   barr   Fnullableffzff.foozff.barfffzfff.ff)r
   rG   r   with_metadataflattenr.   struct)r   f1r   r   s       r   test_field_flattenr     s   	%	$	2	2FF3C	DB::<B4	%	6B	$		2r(+e	<B::<
288:&44ff5EF
2::<%8: : : :
 
$		2r(+	,B::<
288:&44ff5EF
2::<(* * * * ((5"))RD/
*C;;=RXXh		2r(0CDEEEEr   c            	      $   t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|j                  J ddd}|j                  |      }|j                  |k(  sJ |j                         }|j                  J |j                         }|j                  J y )Nr   r   r   r      badgerr   s   pandas)
r
   rG   r   r5   r8   r   r   r   r   remove_metadata)r   s1r   s2s3s4s         r   test_schema_add_remove_metadatar     s    

#
		$
+,F 
6	B;;95H			(	#B;;("""				B;; 
			B;;r   c            	      j   t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|j                  d|j                  d      j                  t        j                                     }|j                  d      j                  t        j                         k(  sJ |j                  d      j                  t        j                         k(  sJ |j                  d|j                  d      j                  d            }|j                  d      j                  du sJ |j                  d      j                  du sJ y )Nr   r   r   r   FT)r
   rG   r   r5   r8   r   r   set	with_typer   r   with_nullabler   )r   r   r   r   s       r   test_schema_set_fieldr     s&   

#
		$
+,F
 
6	B	288A;((4	5B88A;rxxz)))88A;rxxz)))	288A;,,U3	4B88A;4'''88A;5(((r   c                     t        j                  dt        j                               g} t        j                  | ddi      }t        j                  | ddi      }t        j                  | ddi      }t        j                  | ddi      }t	        |      t	        |      k(  sJ t	        |      t	        |      k7  sJ t	        |      t	        |      k7  sJ t	        |      t	        |      k7  sJ t        j                  | i       }t        j                  | d       }t	        |      t	        |      k(  sJ t	        |      t	        |      k7  sJ y )Nr   r   r   r   s   foo_differents   bar_different)r
   rG   r   r   hash)r   schema1schema2schema3schema4schema_empty1schema_empty2s          r   test_schema_hash_metadatar     s   

#F ii&&)9:Gii&&)9:Gii*:F)CDGii&2B)CDG=DM)))=DM)))=DM)))=DM)))IIfr2MIIft4M$}"5555$w-///r   c            	         t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} ddd}t        j                  |       }t        j                  |       }t        j                  | |      }t        j                  | |      }|j                  |d	      sJ |j                  |d	      sJ |j                  |      sJ |j                  |d	      rJ |j                  |d	      rJ | d
= t        j                  |       }|j                  |      rJ y )Nr   r   r   r   r   r   r   Tcheck_metadatar   )r
   rG   r   r5   r8   r   r   equalsr   r   sch1sch2sch3sch4s         r   test_schema_equalsr     s*   

#
		$
+,F
 95H99VD99VD99Vh/D99Vh/D;;tD;111;;tD;111;;t{{4{555{{4{555r
99VD{{4    r   c            	         t        j                  t        j                  dt        j                               t        j                  dt        j                               g      } t        j                  t        j                  dt        j                               t        j                  dt        j                         ddi      g      }| j                  |d      rJ | j                  |      sJ y )Nr   r   aalphar   Tr   )r
   r   rG   r   r5   r   )r   r   s     r   ,test_schema_equals_propagates_check_metadatar     s    ii

#
		$ G ii

#
		sGn= G ~~gd~;;;>>'"""r   c                  8   t        j                  t        j                  dt        j                               g      } d dt        j                  ddg      fD ]5  }t        j                  t              5  | j                  |       d d d        7 y # 1 sw Y   BxY w)Nr   r5   r   r   )	r
   r   rG   r   arrayr   r   r	   r   )r   rN   s     r   test_schema_equals_invalid_typer   !  sy    YYbhhj123Fh!Q 01 ]]9% 	MM#	 		 	s   3BB	c            	      4   t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} ddd}t        j                  |       }t        j                  |       }t        j                  | |      }t        j                  | |      }||k(  sJ ||k(  sJ ||k(  sJ ||k7  rJ ||k(  sJ |g k7  sJ |dk7  sJ y )Nr   r   r   r   r   r   r   )r
   rG   r   r5   r8   r   r   r   s         r   test_schema_equality_operatorsr   *  s    

#
		$
+,F
 95H99VD99VD99Vh/D99Vh/D4<<4<< 4<<t|4<< 2::5==r   c            	      |   t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|j                  d      j                  dk(  sJ |j                  d      j                  dk(  sJ |j                  d      j                  dk(  sJ t        j                  t              5  |j                  d       d d d        t        j                  t              5  |j                  d       d d d        t        j                  t              5  |j                  d       d d d        y # 1 sw Y   pxY w# 1 sw Y   IxY w# 1 sw Y   y xY w)	Nr   r   r   r   r   otherg           )r
   rG   r   r5   r8   r   r   r   r   r   KeyErrorr	   
IndexErrorr   r   s     r   test_schema_get_fieldsr   E  s?   

#
		$
+,F YYvF<<##u,,,<<?5(((<<  E)))	x	  W	y	! S	z	" Q 	   s$   FF&?F2F#&F/2F;c            	         t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j                  t        j
                                     g} t        j                  |       }|d   j                  |d         sJ |d   j                  |d         sJ |d   j                  |d	         sJ t        j                  t              5  |d
    d d d        t        j                  t              5  |d    d d d        y # 1 sw Y   1xY w# 1 sw Y   y xY w)Nr   r   r   r   r   r   r   r   )r
   rG   r   r5   r8   r   r   r   r   r   r   r   s     r   test_schema_negative_indexingr  Z  s	   

#
		$
+,F YYvF":VAY'''":VAY'''":VAY'''	z	" r
 
z	" q	   s   D:+E:EEc                  >   t        j                  dt        j                  t        j                         t        j                                     t        j                  dt        j
                               g} t        j                  |       }d}t        |      |k(  sJ y )NonetwozCone: dictionary<values=string, indices=int16, ordered=0>
two: int32)r
   rG   
dictionaryr   r5   r   r   r   )r   r   re   s      r   "test_schema_repr_with_dictionariesr  n  sp    
bhhj"))+>?

#F ))F
C	 
 9   r   c                    t        j                         t        j                         t        j                         t        j                  d      t        j                  t        j                               t        j
                  t        j                         t        j                               t        j                  t        j                  dd      t        j                  dd      g      t        j                  t        j                  dt        j                               t        j                  dt        j                               gt         j                  j                        t        j                  t        j                  dt        j                               t        j                  dt        j                               gt         j                  j                        t        j                  d      t        j                  d      t        j                         t        j                          t        j"                  d      t        j"                  d	      t        j$                  d
d      t        j&                  dd      t        j(                  dd      t        j*                  dd      t        j                  ddddi      t        j                  t        j                  dt        j,                                     t        j.                  t        j                  dt        j,                                     t        j
                  t        j                  dt        j                         d      t        j                  dt        j                                     g}|D ])  }| j1                  | j3                  |            }||k(  r)J  g }t5        |      D ]Y  \  }}t7        |t         j8                        r|j;                  |       2|j;                  t        j                  d| |             [ t        j<                  |ddi      }| j1                  | j3                  |            }||k(  sJ y )N
   r   r   br5   r\   r]   r#   r_   	   r      r   r$   r   L   &   r   r   r   elementr   Fr   value_f)r
   r   r5   r2   r8   r9   r   rG   unionr   libUnionMode_SPARSEUnionMode_DENSEra   rb   r/   r0   r1   	decimal32	decimal64
decimal128
decimal256r   
large_listloadsdumps	enumerate
isinstanceFieldappendr   )pickle_moduler<   rN   roundtrippedr   ifr   s           r   test_type_schema_picklingr$  }  s   
	
		
		
		"

		RWWY'
		HHS&!HHS(#
 	 	HHS"'')$HHS"((*%
 66""	$ 	HHS"'')$HHS"((*%
 66!!	# 			#
		$
		
		
T
T
Q
R
b!
b"
h&&)9:
)RXXZ01
bhhy"((*56
		e<"''),	.A"EH  #$**=+>+>s+CDl"""# F%  11a"MM!MM"((Rs8Q/0	1 YYv(89F &&}':':6'BCL\!!!r   c                  (   t        j                  t        j                  dt        j                               t        j                  dt        j                  t        j
                         t        j                                     t        j                  dt        j                  t        j                  t        j                                           g      } t        j                  t        j                  dt        j                         d      t        j                  dt        j                               g      }| |fD ]P  }|j                         }t        |t         j                        sJ |j                  dk(  sJ |j                  |k(  rPJ  y )	Nr   r   f2r   Fr   r	  r   )r
   r   rG   r   r  r   r5   r8   empty_tabler  Tablenum_rows)r   r   r   tables       r   test_empty_tabler+    s   ii
rxxz"
r}}RXXZ=>
rxx 456 G ii
bhhj51
bhhj! G
 G$ &""$%***~~"""||v%%%	&r   c            	         dd l } t        t        d             | j                  t        t        d                  g dt	        j
                  g dd       | j
                  g d | j                               g}|D ]g  } | j                  d|i|	      }t        j                  j                  |      }t        j                  j                  |      j                  }||k(  rgJ  y )
Nr   r  )r   r   Nr   qux)z2007-07-13T01:23:34.123456789z2006-01-13T12:34:56.432539784z2010-08-13T05:46:57.437699912r"   )r&   )r   r   Nr   )index)pandaslistrangeCategoricalr%   r   
Int32Dtype	DataFramer
   r   from_pandasr(  r   )r'   inputsdatadfr   re   s         r   test_schema_from_pandasr9    s    U2YtE"I'*
 
 "		#
 	]R]]_5
F  "R\\3+T2&&r*88''+22!!!	"r   c                  (   t        j                  t        j                  dt        j                               t        j                  dt        j                               g      } t        j                  |       t
        j                  dkD  rdndkD  sJ | j                  ddi      }t        j                  |      t        j                  |       kD  sJ | j                  ddi      }t        j                  |      t        j                  |      kD  sJ y )	Nr   r   l              r   zsome metadatazsome more metadata)	r
   r   rG   r   r5   sys	getsizeofmaxsizer   )r   r   r   s      r   test_schema_sizeofr@    s    YY

#
		$ F == #++*=B2FFF""E?#;<G==!CMM&$9999""E+?#@AG==!CMM'$::::r   c                     t        j                  t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j
                  t        j                                     g      } t        j                  t        j                  dt        j                               t        j                  dt        j                               g      }t        j                  t        j                  dt        j                  t        j                         t        j                                     g      }t        j                  t        j                  dt        j                               t        j                  dt        j                               g      }t        j                  | ||g      }t        j                  t        j                  dt        j                               t        j                  dt        j                               t        j                  dt        j
                  t        j                                     t        j                  dt        j                               t        j                  dt        j                  t        j                         t        j                                     g      }|j                  |      sJ t        j                  t         j                        5  t        j                  ||g       d d d        t        j                  | ||f      }|j                  |      sJ t        j                  ||gd      }|j                  |      sJ t        j                  t              5  t        j                  | dg       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)	Nr   r   r   r-  quux
permissive)promote_optionsr   )r
   r   rG   r   r5   r8   r   r+   r  r   unify_schemasr   r   r   ArrowTypeErrorr	   )r   r	  cdr   re   s         r   test_schema_mergerI    s   
		

#
		$
+, 	A
 			

#

# 	A 			
rxxz299;?@ 	A 			

#

# 	A
 q!Qi(Fyy

#
		$
+,

#
rxxz299;?@ H =="""	r((	) !
!Q ! q!Qi(F=="""q!flCF== 
y	! !
!Q ! !! !! !s   %O5O"O"O+c                      d} d}t        j                  t        j                  dt        j                         d| i      gd|i      }dt	        |      v sJ dt	        |      v sJ y )Ns   abcdef s   ghijkl intsr   r   abcdefghijkl)r
   r   rG   r   r   )data1data2r   s      r   test_undecodable_metadatarP    sd    EEYY	&"((*u~	>?!F s6{"""s6{"""r   )6collectionsr   r=  r   r   numpyr%   ImportErrorpyarrowr
   pyarrow.tests.utiltestsutilrA   pyarrow.vendored.versionr   r/  r'   r   r   markr?   	processesrD   rK   rO   rf   rh   rl   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r$  r+  r9  r@  rI  rP  rC   r   r   <module>r[     s  $ $ 
    & & ,	
 !: !:H -  -
.+2\
* '8 '8T6
EP#(*6@F(0)$0,!0#6*(!2"j&& " "(;(!V#w  	B  		s"   D D" DD"D*)D*