Ë
    u™ãjV  ã                   ó�  — d Z ddlZddlZddlZddlmZ ddlZddl	m
Z ddlmZ ddlmZ defd„Zej$                  d„ «       Zej$                  d	„ «       Zej$                  d
„ «       Zej$                  d„ «       Zej$                  d„ «       Zej$                  d„ «       Z G d„ dej2                  «      Z G d„ dej6                  «      Zy)aj  
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.

The tests in this file are inherited from the BaseExtensionTests, and only
minimal tweaks should be applied to get the tests passing (by overwriting a
parent method).

Additional tests should either be added to one of the BaseExtensionTests
classes (if they are relevant for the extension interface for all dtypes), or
be added to the array-specific tests in `pandas/tests/arrays/`.

é    N)Úusing_string_dtype©ÚCategoricalDtype)ÚbaseÚnc                 ó°   — 	 t         j                  j                  d«      j                  t	        t
        j                  «      | ¬«      }|d   |d   k7  r	 |S ŒV)Né   )Úsizer   é   )ÚnpÚrandomÚdefault_rngÚchoiceÚlistÚstringÚascii_letters)r   Úvaluess     úr/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/tests/extension/test_categorical.pyÚ	make_datar      sT   € Ø
Ü—‘×&Ñ& qÓ)×0Ñ0´´f×6JÑ6JÓ1KÐRSÐ0ÓTˆð �!‰9˜˜q™	Ò!ØØ€Mð ó    c                  ó   — t        «       S ©Nr   © r   r   Údtyper   )   s   € äÓÐr   c                  ó>   — t        j                  t        d«      «      S )zˆLength-100 array for this type.

    * data[0] and data[1] should both be non missing
    * data[0] and data[1] should not be equal
    é
   )ÚpdÚCategoricalr   r   r   r   Údatar   .   s   € ô �>‰>œ) B›-Ó(Ð(r   c                  óL   — t        j                  t        j                  dg«      S )zLength 2 array with [NA, Valid]ÚA)r   r   r   Únanr   r   r   Údata_missingr#   8   s   € ô �>‰>œ2Ÿ6™6 3˜-Ó(Ð(r   c                  ó:   — t        j                  g d¢g d¢d¬«      S )N)r!   ÚBÚC)r&   r!   r%   T©Ú
categoriesÚordered©r   r   r   r   r   Údata_for_sortingr+   >   s   € ä�>‰>š/²oÈtÔTÐTr   c                  ó:   — t        j                  g d¢ddgd¬«      S )N)r!   Nr%   r%   r!   Tr'   r*   r   r   r   Údata_missing_for_sortingr-   C   s   € ä�>‰>Ò*¸¸S°zÈ4ÔPÐPr   c                  ó0   — t        j                  g d¢«      S )N)Úar/   NNÚbr0   r/   Úcr*   r   r   r   Údata_for_groupingr2   H   s   € ä�>‰>ÒDÓEÐEr   c                   ó  ‡ — e Zd Zd„ Zd„ Zej                  j                  d¬«      ˆ fd„«       Zd„ Z	ej                  j                  ddd	g«      d
„ «       Zˆ fd„Zˆ fd„Zdej                  fˆ fd„Zej                  j#                  d¬«      ej                  j                  dddg«      ˆ fd„«       «       Zej                  j#                  d¬«      ej                  j                  dddg«      ˆ fd„«       «       Zˆ fd„Zˆ xZS )ÚTestCategoricalc                 óö   — |j                   j                  }||j                  «           }|d   |v sJ ‚|d   |v sJ ‚||v sJ ‚||vsJ ‚t        j                  D ]  }||u rŒ||vsJ ‚t        «       rŒ||v rŒJ ‚ y )Nr   )r   Úna_valueÚisnaÚtmÚNULL_OBJECTSr   )Úselfr   r#   r6   Úna_value_objs        r   Útest_containszTestCategorical.test_containsN   s©   € ð
 —:‘:×&Ñ&ˆà�T—Y‘Y“[�LÑ!ˆð �A‰w˜$‰ÐˆØ˜A‰ ,Ñ.Ð.Ð.ð ˜<Ñ'Ð'Ð'Ø˜tÑ#Ð#Ð#ô ŸO™Oò 	4ˆLØ˜xÑ'ØØ tÑ+Ð+Ð+ä%Õ'Ø# |Ò3Ð3Ð3ñ	4r   c                 óš   — |j                  «       }|j                  d|¬«      }t        ||«      sJ ‚|j                  t	        g «      k(  sJ ‚y )N)é   )r   )Úconstruct_array_typeÚ_emptyÚ
isinstancer   r   )r:   r   ÚclsÚresults       r   Ú
test_emptyzTestCategorical.test_emptyh   sL   € Ø×(Ñ(Ó*ˆØ—‘˜D¨�Ó.ˆä˜& #Ô&Ð&Ð&ð �|‰|Ô/°Ó3Ò3Ð3Ñ3r   zBackwards compatibility©Úreasonc                 ó$   •— t         ‰| �  |«       y r   )ÚsuperÚtest_getitem_scalar)r:   r   Ú	__class__s     €r   rI   z#TestCategorical.test_getitem_scalarq   s   ø€ ô
 	‰Ñ# DÕ)r   c                 ó6  —  |d«      \  }}t        j                  |«      }t        j                  |«      }|j                  |d„ «      }t        j                  t        t	        |«      t	        |«      d¬«      D ��cg c]
  \  }}||z   ‘Œ c}}«      }	t        j                  ||	«       |j                  d   }
|j                  |
d„ «      }t        j                  t	        |«      D �cg c]  }||
z   ‘Œ	 c}«      }	t        j                  ||	«       y c c}}w c c}w )Nr	   c                 ó   — | |z   S r   r   ©Úx1Úx2s     r   ú<lambda>z2TestCategorical.test_combine_add.<locals>.<lambda>~   s
   € ¨r°B©w€ r   T)Ústrictr   c                 ó   — | |z   S r   r   rM   s     r   rP   z2TestCategorical.test_combine_add.<locals>.<lambda>…   s
   € °°R±€ r   )r   ÚSeriesÚcombineÚzipr   r8   Úassert_series_equalÚiloc)r:   Údata_repeatedÚ
orig_data1Ú
orig_data2Ús1Ús2rC   r/   r0   ÚexpectedÚvals              r   Útest_combine_addz TestCategorical.test_combine_addx   sæ   € ñ "/¨qÓ!1Ñˆ
�JÜ�Y‰Y�zÓ"ˆÜ�Y‰Y�zÓ"ˆØ—‘˜BÑ 6Ó7ˆÜ—9‘9Ü!$¤T¨*Ó%5´t¸JÓ7GÐPTÔ!U×V‘v˜˜1ˆQ�‹UÓVó
ˆô 	×Ñ˜v xÔ0à�g‰g�a‰jˆØ—‘˜CÑ!7Ó8ˆÜ—9‘9¬t°JÓ/?Ö@¨!˜a #›gÒ@ÓAˆÜ
×Ñ˜v xÕ0ùó Wùò As   Á;D
Ã&DÚ	na_actionNÚignorec                 óX   — |j                  d„ |¬«      }t        j                  ||«       y )Nc                 ó   — | S r   r   )Úxs    r   rP   z*TestCategorical.test_map.<locals>.<lambda>‹   s   €  A€ r   )r`   )Úmapr8   Úassert_extension_array_equal)r:   r   r`   rC   s       r   Útest_mapzTestCategorical.test_map‰   s$   € à—‘™+°�Ó;ˆÜ
×'Ñ'¨°Õ5r   c                 ó’   •— |}|dk(  r/|j                  t        j                  j                  d¬«      «       t        ‰| �  ||«       y ©NÚ__rmod__z/rmod never called when string is first argumentrE   )ÚapplymarkerÚpytestÚmarkÚxfailrH   Útest_arith_frame_with_scalar©r:   r   Úall_arithmetic_operatorsÚrequestÚop_namerJ   s        €r   ro   z,TestCategorical.test_arith_frame_with_scalarŽ   sI   ø€ à*ˆØ�jÒ Ø×ÑÜ—‘×!Ñ!ØLð "ó ôô
 	‰Ñ,¨T°7Õ;r   c                 ó’   •— |}|dk(  r/|j                  t        j                  j                  d¬«      «       t        ‰| �  ||«       y ri   )rk   rl   rm   rn   rH   Útest_arith_series_with_scalarrp   s        €r   ru   z-TestCategorical.test_arith_series_with_scalar™   sI   ø€ Ø*ˆØ�jÒ Ø×ÑÜ—‘×!Ñ!ØLð "ó ôô
 	‰Ñ-¨d°GÕ<r   Úserc                 óÈ   •— d|j                   › d�}|dvr0d}t        j                  t        |¬«      5   |||«       d d d «       y t        ‰| �  ||||«      S # 1 sw Y   y xY w)NÚ__)Ú__eq__Ú__ne__z7Unordered Categoricals can only compare equality or not©Úmatch)Ú__name__rl   ÚraisesÚ	TypeErrorrH   Ú_compare_other)r:   rv   r   ÚopÚotherrs   ÚmsgrJ   s          €r   r€   zTestCategorical._compare_other£   sl   ø€ Ø�r—{‘{�m 2Ð&ˆØÐ.Ñ.ØKˆCÜ—‘œy°Ô4ñ  Ù�4˜”÷ ð  ô ‘7Ñ)¨#¨t°R¸Ó?Ð?÷ ð  ús   ³
AÁA!zCategorical overrides __repr__r
   ÚbigÚsmallc                 ó&   •— t         ‰| �  ||«       y r   )rH   Útest_array_repr)r:   r   r
   rJ   s      €r   r‡   zTestCategorical.test_array_repr¬   s   ø€ ô 	‰Ñ  dÕ+r   ÚTBDÚas_indexTFc                 ó&   •— t         ‰| �  ||«       y r   )rH   Útest_groupby_extension_agg)r:   r‰   r2   rJ   s      €r   r‹   z*TestCategorical.test_groupby_extension_agg±   s   ø€ ô 	‰Ñ*¨8Ð5FÕGr   c                 ó„   •— t        j                  t        d¬«      5  t        ‰| �  |«       d d d «       y # 1 sw Y   y xY w)Nzno numeric data to plotr{   )rl   r~   r   rH   Útest_plot_on_y_axis)r:   Ú	plot_datarJ   s     €r   r�   z#TestCategorical.test_plot_on_y_axis¶   s6   ø€ ô �]‰]œ9Ð,EÔFñ 	3Ü‰GÑ'¨	Ô2÷	3÷ 	3ñ 	3ús   �6¶?)r}   Ú
__module__Ú__qualname__r<   rD   rl   rm   ÚskiprI   r_   Úparametrizerg   ro   ru   r   rS   r€   rn   r‡   r‹   r�   Ú__classcell__)rJ   s   @r   r4   r4   M   s  ø„ ò4ò44ð ‡[�[×ÑÐ6ÐÓ7ó*ó 8ð*ò1ð" ‡[�[×Ñ˜[¨4°Ð*:Ó;ñ6ó <ð6ô	<ô=ð@ "§)¡)õ @ð ‡[�[×ÑÐ>ÐÓ?Ø‡[�[×Ñ˜V e¨WÐ%5Ó6ó,ó 7ó @ð,ð ‡[�[×Ñ˜eÐÓ$Ø‡[�[×Ñ˜Z¨$°¨Ó7óHó 8ó %ðH÷3ð 3r   r4   c                   ó   — e Zd Zd„ Zy)ÚTest2DCompatc                 óÈ   — t        |j                  dd«      «      }|j                  d«      dk(  sJ ‚t        |j                  dd«      «      }|j                  d«      dk(  sJ ‚y )Nr   éÿÿÿÿz
Categories)ÚreprÚreshapeÚcount)r:   r   Úress      r   Útest_repr_2dzTest2DCompat.test_repr_2d¾   s\   € ô �4—<‘<  2Ó&Ó'ˆØ�y‰y˜Ó(¨AÒ-Ð-Ð-ä�4—<‘<  AÓ&Ó'ˆØ�y‰y˜Ó(¨AÒ-Ð-Ñ-r   N)r}   r�   r�   rœ   r   r   r   r•   r•   ½   s   „ ó.r   r•   )Ú__doc__r   Únumpyr   rl   Úpandas._configr   Úpandasr   Úpandas._testingÚ_testingr8   Úpandas.api.typesr   Úpandas.tests.extensionr   Úintr   Úfixturer   r   r#   r+   r-   r2   ÚExtensionTestsr4   ÚNDArrayBacked2DTestsr•   r   r   r   ú<module>r©      sí   ðñó  ã Û å -ã Ý Ý -Ý 'ð�ó ð ‡�ñó ðð ‡�ñ)ó ð)ð ‡�ñ)ó ð)ð
 ‡�ñUó ðUð ‡�ñQó ðQð ‡�ñFó ðFôm3�d×)Ñ)ô m3ô`.�4×,Ñ,õ .r   