
    Mh              
          S SK JrJr  S SKrS SKJs  Jr  S SKr	S SK
Jr  S rS r\R                  \R                   R"                  S 5       5       rS rS rS rS	 r\R                   R/                  S
S\R0                  " S\R2                  " S5      S9/5      \R                   R/                  SSS/5      \R                   R/                  SSS/5      S 5       5       5       rS rg)    )BytesIOStringIONc           	         [         R                  " / SQ/ SQ/SS// SQS9n[        R                  " 5        nUR	                  X S9  [        R
                  " U[         R                  " X S95        [        R                  " X 5       nUR                  5       R                  S5      n[        U5      nS S S 5        [        R
                  " U[         R                  " W5      5        S S S 5        g ! , (       d  f       NB= f! , (       d  f       g = f)	N)g~Ϛ?g9DܜJ?g>D)?)g.4i(@g33333@g̤AAB)XYZ)indexcolumnscompressionutf8)pd	DataFrametmensure_cleanto_jsonassert_frame_equal	read_jsondecompress_filereaddecoder   )r   dfpathfhresultdatas         W/var/www/html/env/lib/python3.13/site-packages/pandas/tests/io/json/test_compression.pytest_compression_roundtripr       s    		')GHCj
B 
	d


4
1
b",,t"MN 2bWWY%%f-FF#D 3 	b",,t"45 
	
 32 
	s$   AC=+C,03C=,
C:	6C==
Dc                     U " SSSS5      n[         R                  " U5      nU " SSSS5      n[         R                  " USS9n[        R                  " X$5        g )Niojsonr   ztsframe_v012.jsonztsframe_v012.json.zipzipr   )r   r   r   r   )datapathuncompressed_pathuncompressed_dfcompressed_pathcompressed_dfs        r   test_read_zipped_jsonr*       sR     vv7JKll#45OtVV5LMOLLeDM/9    c                    [         R                  " [        S5      5      n[        R                  " 5        nUR                  X@S9  [        US5       nUR                  SUS9  S S S 5        S S S 5        [         R                  " SUR                   S3U US9n[        R                  " X65        g ! , (       d  f       NQ= f! , (       d  f       NZ= f)	N {"a": [1, 2, 3], "b": [4, 5, 6]}r   rbztest-1)KeyBodyzs3://z/test-1)r   storage_options)
r   r   r   r   r   r   open
put_objectnamer   )r   s3_public_buckets3sor   r   froundtripped_dfs          r   test_with_s3_urlr9   *   s     
hAB	CB		d


4
1$''H1'=  

 ll
 %%&g.O
 ".  
	s#   B>B-"B>-
B;	7B>>
Cc                    [         R                  " 5        n[        R                  " [	        S5      5      nUR                  USSU S9  [        R                  " USU S9n[         R                  " X#5        S S S 5        g ! , (       d  f       g = f)Nr-   recordsTorientlinesr   )r>   r   )r   r   r   r   r   r   r   )r   r   r   r8   s       r   test_lines_with_compressionr?   =   sb    		d\\(#EFG


4	;
O,,t4[Q
b2	 
		s   AA==
Bc                    [         R                  " 5        n[        R                  " [	        S5      5      nUR                  USSU S9  [        R                  " USSU S9 n[        R                  " U5      nS S S 5        [         R                  " UW5        S S S 5        g ! , (       d  f       N.= f! , (       d  f       g = f)Nz,{"a": ["foo", "bar", "baz"], "b": [4, 5, 6]}r;   Tr<      )r>   	chunksizer   )r   r   r   r   r   r   concatr   )r   r   r   resr8   s        r   test_chunksize_with_compressionrE   E   s    		d\\(#QRS


4	;
O\\{
 iinO
 	b/2 
	
 
	 
	s$   A	B/B6B/
B,	(B//
B=c                  *   [         R                  " [        S5      5      n [        R                  " 5        nSn[
        R                  " [        US9   U R                  USS9  S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nr-   *Unrecognized compression type: unsupportedmatchunsupportedr   )	r   r   r   r   r   pytestraises
ValueErrorr   )r   r   msgs      r   'test_write_unsupported_compression_typerO   Q   sb    	hAB	CB		d:]]:S1JJtJ7 2 
	11 
	s#   BA3"B3
B	=B
Bc                      [         R                  " 5        n Sn[        R                  " [        US9   [
        R                  " U SS9  S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)NrG   rH   rJ   r   )r   r   rK   rL   rM   r   r   )r   rN   s     r   &test_read_unsupported_compression_typerQ   Y   sL    		d:]]:S1LL=9 2 
	11 
	s"   A*AA*
A'	#A**
A8infer_stringFTpyarrow)marksto_infer
read_inferc                    [         R                  " SU5         U nSnXcU   -  n[         R                  " SS/05      nU(       a  SOUnU(       a  SOUn	[        R                  " U5       n
UR                  XS9  [         R                  " XS9n[        R                  " X5        S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nzfuture.infer_stringztest.r   rA   inferr   )r   option_contextr   r   r   r   r   r   )compression_onlyrV   rU   compression_to_extensionrR   r   filenamer   to_compressionread_compressionr   r   s               r   test_to_json_compressionr_   `   s     
		0,	?& [99\\3*%$,+&07k__X&$JJtJ8\\$EF!!&- ' 
@	? '& 
@	?s$   AC):B4#C4
C	>C
Cc                     [         R                  " SS/05      n[        5        nUR                  X S9  S S S 5        g ! , (       d  f       g = f)Nr   rA   r   )r   r   r   r   )r   expectedbuffers      r   test_to_json_compression_moderc   {   s8    ||S1#J'H	f9 
s	   =
A)r"   r   r   rK   pandas.util._test_decoratorsutil_test_decoratorstdpandasr   pandas._testing_testingr   r    r*   skip_if_not_us_localemark
single_cpur9   r?   rE   rO   rQ   parametrizeparam
skip_if_nor_   rc    r+   r   <module>rr      s   
  ) )  6$: /  /"3	38: UFLLR]]95MNO dE]3e}5. 6 4
.,:r+   