ó
    ­œ‘hœ  ã                   ó–  • S r SSKrSSKrSSKrSSKJr  SSKrSSKJ	r	  SSK
Jr  SSKJr  SSKJr  S r\R$                  S 5       r\R$                  S	 5       r\R$                  S
 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r " S S\R2                  5      r " S S\R6                  5      rg)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©ÚCategorical©ÚCategoricalDtype)Úbasec                  ó®   •  [         R                  R                  S5      R                  [	        [
        R                  5      SS9n U S   U S   :w  a   U $ MU  )Né   éd   )Úsizer   é   )ÚnpÚrandomÚdefault_rngÚchoiceÚlistÚstringÚascii_letters)Úvaluess    ÚkC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\pandas/tests/extension/test_categorical.pyÚ	make_datar      sT   € Ø
Ü—‘×&Ñ& qÓ)×0Ñ0´´f×6JÑ6JÓ1KÐRUÐ0ÐVˆð �!‰9˜˜q™	Ó!ØØ€Mñ ó    c                  ó   • [        5       $ ©Nr   © r   r   Údtyper   )   s   € äÓÐr   c                  ó(   • [        [        5       5      $ )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
)r   r   r   r   r   Údatar   .   s   € ô ”y“{Ó#Ð#r   c                  ó8   • [        [        R                  S/5      $ )zLength 2 array with [NA, Valid]ÚA)r   r   Únanr   r   r   Údata_missingr"   8   s   € ô œŸ™ �}Ó%Ð%r   c                  ó    • [        / SQ/ SQSS9$ )N)r    ÚBÚC)r%   r    r$   T©Ú
categoriesÚorderedr   r   r   r   Údata_for_sortingr)   >   s   € ä’²?ÈDÑQÐQr   c                  ó    • [        / SQSS/SS9$ )N)r    Nr$   r$   r    Tr&   r   r   r   r   Údata_missing_for_sortingr+   C   s   € äÒ'°S¸#°JÈÑMÐMr   c                  ó   • [        / SQ5      $ )N)Úar-   NNÚbr.   r-   Úcr   r   r   r   Údata_for_groupingr0   H   s   € äÒAÓBÐBr   c                   óŽ  ^ • \ rS rSr\R
                  R                  SS9U 4S j5       rS rS r	\R
                  R                  SS9U 4S j5       r\R
                  R                  S	S9U 4S
 j5       rS r\R
                  R                  SSS/5      S 5       rU 4S jrU 4S jrS\R&                  4U 4S jjr\R
                  R                  SS9\R
                  R                  SSS/5      U 4S j5       5       r\R
                  R                  SS9\R
                  R                  SSS/5      U 4S j5       5       rSrU =r$ )ÚTestCategoricaléM   zMemory usage doesn't match©Úreasonc                 ó$   >• [         TU ]  U5        g r   )ÚsuperÚtest_memory_usage©Úselfr   Ú	__class__s     €r   r8   Ú!TestCategorical.test_memory_usageN   s   ø€ ô 	‰Ñ! $Õ'r   c                 ó  • UR                   R                  nXR                  5       )    nUS   U;   d   eUS   U;   d   eX2;   d   eX1;  d   e[        R                   H(  nXCL a  M	  XA;  d   e[        5       (       a  M!  XB;   a  M(   e   g )Nr   )r   Úna_valueÚisnaÚtmÚNULL_OBJECTSr   )r:   r   r"   r>   Úna_value_objs        r   Útest_containsÚTestCategorical.test_containsS   s›   € ð
 —:‘:×&Ñ&ˆà—Y‘Y“[�LÑ!ˆð �A‰w˜$‹ÐˆØ˜A‰ ,Ó.Ð.Ð.ð Ó'Ð'Ð'ØÓ#Ð#Ð#ô ŸOœOˆLØÒ'ÙØÓ+Ð+Ð+ä%×'Ó'Ø#Õ3Ð3Ð3ò ,r   c                 óž   • UR                  5       nUR                  SUS9n[        X25      (       d   eUR                  [	        / 5      :X  d   eg )N)é   )r   )Úconstruct_array_typeÚ_emptyÚ
isinstancer   r   )r:   r   ÚclsÚresults       r   Ú
test_emptyÚTestCategorical.test_emptym   sM   € Ø×(Ñ(Ó*ˆØ—‘˜D¨�Ð.ˆä˜&×&Ñ&Ð&Ð&ð �|‰|Ô/°Ó3Ó3Ð3Ñ3r   zBackwards compatibilityc                 ó$   >• [         TU ]  U5        g r   )r7   Útest_getitem_scalarr9   s     €r   rO   Ú#TestCategorical.test_getitem_scalarv   s   ø€ ô
 	‰Ñ# DÕ)r   zUnobserved categories includedc                 ó"   >• [         TU ]  X5      $ r   )r7   Útest_value_counts)r:   Úall_dataÚdropnar;   s      €r   rR   Ú!TestCategorical.test_value_counts}   s   ø€ ä‰wÑ(¨Ó:Ð:r   c                 ó>  • U" S5      u  p#[         R                  " U5      n[         R                  " U5      nUR                  US 5      n[         R                  " [        [	        U5      [	        U5      5       VVs/ s H	  u  pxXx-   PM     snn5      n	[
        R                  " Xi5        UR                  S   n
UR                  U
S 5      n[         R                  " [	        U5       Vs/ s H  owU
-   PM	     sn5      n	[
        R                  " Xi5        g s  snnf s  snf )Nr
   c                 ó
   • X-   $ r   r   ©Úx1Úx2s     r   Ú<lambda>Ú2TestCategorical.test_combine_add.<locals>.<lambda>‡   s   € ¨rªwr   r   c                 ó
   • X-   $ r   r   rX   s     r   r[   r\   Ž   s   € °²r   )ÚpdÚSeriesÚcombineÚzipr   r@   Úassert_series_equalÚiloc)r:   Údata_repeatedÚ
orig_data1Ú
orig_data2Ús1Ús2rK   r-   r.   ÚexpectedÚvals              r   Útest_combine_addÚ TestCategorical.test_combine_add�   sã   € ñ "/¨qÓ!1Ñˆ
Ü�YŠY�zÓ"ˆÜ�YŠY�zÓ"ˆØ—‘˜BÑ 6Ó7ˆÜ—9’9Ü!$¤T¨*Ó%5´t¸JÓ7GÔ!HÔIÒ!H‘v˜ˆQŒUÑ!HÒIó
ˆô 	×Ò˜vÔ0à�g‰g�a‰jˆØ—‘˜CÑ!7Ó8ˆÜ—9’9¬t°JÔ/?Ó@Ò/?¨! #œgÑ/?Ñ@ÓAˆÜ
×Ò˜vÕ0ùó Jùò As   Á;D
Ã(DÚ	na_actionNÚignorec                 óR   • UR                  S US9n[        R                  " X15        g )Nc                 ó   • U $ r   r   )Úxs    r   r[   Ú*TestCategorical.test_map.<locals>.<lambda>”   s   € ¡Ar   )rm   )Úmapr@   Úassert_extension_array_equal)r:   r   rm   rK   s       r   Útest_mapÚTestCategorical.test_map’   s"   € à—‘™+°�Ð;ˆÜ
×'Ò'¨Õ5r   c                 óŒ   >• UnUS:X  a,  UR                  [        R                  R                  SS95        [        TU ]  X5        g ©NÚ__rmod__z/rmod never called when string is first argumentr4   )ÚapplymarkerÚpytestÚmarkÚxfailr7   Útest_arith_frame_with_scalar©r:   r   Úall_arithmetic_operatorsÚrequestÚop_namer;   s        €r   r~   Ú,TestCategorical.test_arith_frame_with_scalar—   sG   ø€ à*ˆØ�jÓ Ø×ÑÜ—‘×!Ñ!ØLð "ð ôô
 	‰Ñ,¨TÕ;r   c                 óŒ   >• UnUS:X  a,  UR                  [        R                  R                  SS95        [        TU ]  X5        g rx   )rz   r{   r|   r}   r7   Útest_arith_series_with_scalarr   s        €r   r…   Ú-TestCategorical.test_arith_series_with_scalar¢   sG   ø€ Ø*ˆØ�jÓ Ø×ÑÜ—‘×!Ñ!ØLð "ð ôô
 	‰Ñ-¨dÕ<r   Úserc                 óÌ   >• SUR                    S3nUS;  a-  Sn[        R                  " [        US9   U" X$5        S S S 5        g [        TU ]  XX45      $ ! , (       d  f       g = f)NÚ__)Ú__eq__Ú__ne__z7Unordered Categoricals can only compare equality or not)Úmatch)Ú__name__r{   ÚraisesÚ	TypeErrorr7   Ú_compare_other)r:   r‡   r   ÚopÚotherr‚   Úmsgr;   s          €r   r�   ÚTestCategorical._compare_other¬   s]   ø€ Ø�r—{‘{�m 2Ð&ˆØÐ.Ó.ØKˆCÜ—’œy°Ó4Ù�4”÷ 5Ð4ô ‘7Ñ)¨#°RÓ?Ð?÷ 5Õ4ús   ³	AÁ
A#zCategorical overrides __repr__r   ÚbigÚsmallc                 ó$   >• [         TU ]  X5        g r   )r7   Útest_array_repr)r:   r   r   r;   s      €r   r˜   ÚTestCategorical.test_array_reprµ   s   ø€ ô 	‰Ñ Õ+r   ÚTBDÚas_indexTFc                 ó$   >• [         TU ]  X5        g r   )r7   Útest_groupby_extension_agg)r:   r›   r0   r;   s      €r   r�   Ú*TestCategorical.test_groupby_extension_aggº   s   ø€ ô 	‰Ñ*¨8ÕGr   r   )r�   Ú
__module__Ú__qualname__Ú__firstlineno__r{   r|   r}   r8   rC   rL   ÚskiprO   rR   rk   Úparametrizeru   r~   r…   r^   r_   r�   r˜   r�   Ú__static_attributes__Ú__classcell__)r;   s   @r   r2   r2   M   sW  ø† Ø‡[�[×ÑÐ:ÐÐ;ô(ó <ð(ò4ò44ð ‡[�[×ÑÐ6ÐÐ7ô*ó 8ð*ð ‡[�[×ÑÐ>ÐÐ?ô;ó @ð;ò1ð" ‡[�[×Ñ˜[¨4°Ð*:Ó;ñ6ó <ð6õ	<õ=ð@ "§)¡)÷ @ð ‡[�[×ÑÐ>ÐÐ?Ø‡[�[×Ñ˜V e¨WÐ%5Ó6ô,ó 7ó @ð,ð ‡[�[×Ñ˜eÐÐ$Ø‡[�[×Ñ˜Z¨$°¨Ó7ôHó 8ó %öHr   r2   c                   ó   • \ rS rSrS rSrg)ÚTest2DCompatéÀ   c                 óÌ   • [        UR                  SS5      5      nUR                  S5      S:X  d   e[        UR                  SS5      5      nUR                  S5      S:X  d   eg )Nr   éÿÿÿÿz
Categories)ÚreprÚreshapeÚcount)r:   r   Úress      r   Útest_repr_2dÚTest2DCompat.test_repr_2dÁ   s\   € ô �4—<‘<  2Ó&Ó'ˆØ�y‰y˜Ó(¨AÓ-Ð-Ð-ä�4—<‘<  AÓ&Ó'ˆØ�y‰y˜Ó(¨AÓ-Ð-Ñ-r   r   N)r�   rŸ   r    r¡   r¯   r¤   r   r   r   r§   r§   À   s   † õ.r   r§   )Ú__doc__r   Únumpyr   r{   Úpandas._configr   Úpandasr^   r   Úpandas._testingÚ_testingr@   Úpandas.api.typesr   Úpandas.tests.extensionr   r   Úfixturer   r   r"   r)   r+   r0   ÚExtensionTestsr2   ÚNDArrayBacked2DTestsr§   r   r   r   Ú<module>r¼      së   ðñó ã Û å -ã Ý Ý Ý -Ý 'òð ‡�ñó ðð ‡�ñ$ó ð$ð ‡�ñ&ó ð&ð
 ‡�ñRó ðRð ‡�ñNó ðNð ‡�ñCó ðCôpH�d×)Ñ)ô pHôf.�4×,Ñ,õ .r   