
    -i                         S SK r S SKJr  S SKrS SKJrJrJrJr  \R                  R                  S/ SQSS/4/ SQS/4/ SQ/ 4/5      S 5       rS	 r\R                  R                  S
\\/5      S 5       r\R                  R                  S
\\/5      S 5       r\R                  R                  S
\R                  " \\R                  R                   S9\/5      S 5       rg)    N)BytesIO)_liac_arff_parser_pandas_arff_parser_post_process_frameload_arff_from_gzip_filezfeature_names, target_names)col_int_as_integercol_int_as_numericcol_float_as_realcol_float_as_numericcol_categorical
col_stringc           	         [         R                  " S5      nUR                  / SQ/ SQ/ SQ/ SQ/ SQ/ SQS.5      n[        X0U5      u  pE[	        XBR                  5      (       d   e[        U5      S:  a  [	        XRR                  5      (       d   eg[        U5      S:X  a  [	        XRR                  5      (       d   egUb   eg)	zNCheck the behaviour of the post-processing function for splitting a dataframe.pandas)         )g      ?g       @g      @)abc)r   r	   r
   r   r   r   r   r   N)pytestimportorskip	DataFramer   
isinstancelenSeries)feature_namestarget_namespd
X_originalXys         Z/var/www/html/venv/lib/python3.13/site-packages/sklearn/datasets/tests/test_arff_parser.pytest_post_process_framer#      s    D 
		X	&B"+"+!0$3.)	
	J z,GDAa&&&&
<A!\\****	\	a	!YY''''yy    c            	          Sn [         R                  " [        U S9   [        SSSSSS5        SSS5        g! , (       d  f       g= f)z3An error will be raised if the parser is not known.z8Unknown parser: 'xxx'. Should be 'liac-arff' or 'pandas')matchxxxN)r   raises
ValueErrorr   )err_msgs    r"   *test_load_arff_from_gzip_file_error_parserr+   G   s6    
 IG	z	1 ueUEJ 
2	1	1s	   6
Aparser_funcc                    [         R                  " S5      n[        [        R                  " S5      R                  S5      5      nSSS.SSS.SS	S.S
SS.S.n/ SQnS/nSU [        L a  SOSU [        L a  SOSSS.nU " USUUUS9u    pxnUR                  R                  5       XE-   :X  d   eUR                  R                  UR                  S   UR                  USS95        g)z9Check that we properly strip single quotes from the data.r   a5  
            @relation 'toy'
            @attribute 'cat_single_quote' {'A', 'B', 'C'}
            @attribute 'str_single_quote' string
            @attribute 'str_nested_quote' string
            @attribute 'class' numeric
            @data
            'A','some text','"expect double quotes"',0
            utf-8nominalcat_single_quote	data_typenamestringstr_single_quotestr_nested_quotenumericclass)r0   r5   r6   r8   )r0   r5   r6   A	some textz'some text'z"expect double quotes"z'"expect double quotes"'r   output_arrays_typeopenml_columns_infofeature_names_to_selecttarget_names_to_selectr3   N)r   r   r   textwrapdedentencoder   columnstolisttestingassert_series_equalilocr   	r,   r   	arff_filecolumns_infor   r   expected_values_frames	            r"   +test_pandas_arff_parser_strip_single_quotesrO   Q   s    
		X	&B
	
 &/I  #&

 "&

 "&

 #
L&M
 9L  &*;;K // %-O !#( -+NAq ==!]%AAAAJJ""5::a="))ORS)2TUr$   c                    [         R                  " S5      n[        [        R                  " S5      R                  S5      5      nSSS.SSS.SS	S.S
SS.S.n/ SQnS/nSSSSS.nU " USUUUS9u    pxnUR                  R                  5       XE-   :X  d   eUR                  R                  UR                  S   UR                  USS95        g)z9Check that we properly strip double quotes from the data.r   a5  
            @relation 'toy'
            @attribute 'cat_double_quote' {"A", "B", "C"}
            @attribute 'str_double_quote' string
            @attribute 'str_nested_quote' string
            @attribute 'class' numeric
            @data
            "A","some text","'expect double quotes'",0
            r.   r/   cat_double_quoter1   r4   str_double_quoter6   r7   r8   )rQ   rR   r6   r8   )rQ   rR   r6   r9   r:   z'expect double quotes'r   r;   r@   Nr   r   r   rA   rB   rC   rD   rE   rF   rG   rH   r   rI   s	            r"   +test_pandas_arff_parser_strip_double_quotesrT      s    
		X	&B
	
 &/I  #&

 "&

 "&

 #
L&M
 9L  '4	O !#( -+NAq ==!]%AAAAJJ""5::a="))ORS)2TUr$   )marksc                    [         R                  " S5      n[        [        R                  " S5      R                  S5      5      nSSS.SSS.SS	S.S
SS.S.n/ SQnS/nSSSSS.nU " USUUUS9u    pxnUR                  R                  5       XE-   :X  d   eUR                  R                  UR                  S   UR                  USS95        g)z7Check that we properly parse with no quotes characters.r   a'  
            @relation 'toy'
            @attribute 'cat_without_quote' {A, B, C}
            @attribute 'str_without_quote' string
            @attribute 'str_internal_quote' string
            @attribute 'class' numeric
            @data
            A,some text,'internal' quote,0
            r.   r/   cat_without_quoter1   r4   str_without_quotestr_internal_quoter7   r8   )rW   rX   rY   r8   )rW   rX   rY   r9   r:   z'internal' quoter   r;   r@   NrS   rI   s	            r"   'test_pandas_arff_parser_strip_no_quotesrZ      s    
		X	&B
	
 &/I  #'

 "'

 "(

 #
L&M
 9L !(0	O !#( -+NAq ==!]%AAAAJJ""5::a="))ORS)2TUr$   )rA   ior   r   sklearn.datasets._arff_parserr   r   r   r   markparametrizer#   r+   rO   rT   paramxfailrZ    r$   r"   <module>rb      s.       ! -	
 	
 	
'@A@2K ):<O(PQCV RCVL ):<O(PQ<V R<V~  	&fkk.?.?@<V<Vr$   