hyb
2025-11-04 668edf874b4f77214a8ff4513e60e3c1a973f532
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Ë
oñúhœãó–—dZddlZddlZddlZddlmZddlZddlm    Z    ddl
m Z ddl mZddlmZd„Zej$d„«Zej$d    „«Zej$d
„«Zej$d „«Zej$d „«Zej$d „«ZGd„dej2«ZGd„dej6«Zy)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󰗠   tjjd«jt    t
j «d¬«}|d|dk7r    |SŒV)Nééd)Úsizeré)ÚnpÚrandomÚ default_rngÚchoiceÚlistÚstringÚ ascii_letters)Úvaluess úZH:\Change_password\venv_build\Lib\site-packages\pandas/tests/extension/test_categorical.pyÚ    make_datarsT€Ø
Ü—‘×&Ñ& qÓ)×0Ñ0´´f×6JÑ6JÓ1KÐRUÐ0ÓVˆð !‰9˜˜q™    Ò !Ø Ø €Mð ócó—t«S©Nr©rrÚdtyper)s €ä Ó Ðrcó(—tt««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
    )rrrrrÚdatar.s€ô ”y“{Ó #Ð#rcó8—ttjdg«S)zLength 2 array with [NA, Valid]ÚA)rrÚnanrrrÚ data_missingr"8s€ô œŸ™ }Ó %Ð%rcó&—tgd¢gd¢d¬«S)N)r ÚBÚC)r%r r$T©Ú
categoriesÚorderedrrrrÚdata_for_sortingr)>s€ä ’²?ÈDÔ QÐQrcó&—tgd¢ddgd¬«S)N)r Nr$r$r Tr&rrrrÚdata_missing_for_sortingr+Cs€ä Ò'°S¸#°JÈÔ MÐMrcó—tgd¢«S)N)Úar-NNÚbr.r-ÚcrrrrÚdata_for_groupingr0Hs€ä ÒAÓ BÐBrcó’‡—eZdZejj d¬«ˆfd„«Zd„Zd„Zejjd¬«ˆfd„«Z
ejj d¬«ˆfd    „«Z d
„Z ejjd d d g«d„«Zˆfd„Zˆfd„Zdej$fˆfd„ Zejj d¬«ejjdddg«ˆfd„««Zejj d¬«ejjdddg«ˆfd„««ZˆxZS)ÚTestCategoricalzMemory usage doesn't match©Úreasoncó$•—t‰||«yr)ÚsuperÚtest_memory_usage©ÚselfrÚ    __class__s  €rr7z!TestCategorical.test_memory_usageNsø€ô    ‰Ñ! $Õ'rcóö—|jj}||j«}|d|vsJ‚|d|vsJ‚||vsJ‚||vsJ‚tjD]}||urŒ||vsJ‚t «rŒ||vrŒJ‚y)Nr)rÚna_valueÚisnaÚtmÚ NULL_OBJECTSr)r9rr"r<Ú na_value_objs     rÚ test_containszTestCategorical.test_containsSs©€ð
—:‘:×&Ñ&ˆàT—Y‘Y“[LÑ!ˆðA‰w˜$‰ÐˆØ˜A‰ ,Ñ.Ð.Ð.ð˜<Ñ'Ð'Ð'ؘtÑ#Ð#Ð#ôŸO™Oò    4ˆLؘxÑ'ØØ tÑ+Ð +Ð+ä%Õ'Ø# |Ò3Ð3Ð3ñ     4rcóš—|j«}|jd|¬«}t||«sJ‚|jt    g«k(sJ‚y)N)é)r)Úconstruct_array_typeÚ_emptyÚ
isinstancerr)r9rÚclsÚresults    rÚ
test_emptyzTestCategorical.test_emptymsL€Ø×(Ñ(Ó*ˆØ—‘˜D¨Ó.ˆä˜& #Ô&Ð&Ð&ð|‰|Ô/°Ó3Ò3Ð3Ñ3rzBackwards compatibilitycó$•—t‰||«yr)r6Útest_getitem_scalarr8s  €rrKz#TestCategorical.test_getitem_scalarvsø€ô
    ‰Ñ# DÕ)rzUnobserved categories includedcó$•—t‰|||«Sr)r6Útest_value_counts)r9Úall_dataÚdropnar:s   €rrMz!TestCategorical.test_value_counts}sø€ä‰wÑ(¨°6Ó:Ð:rcó2—|d«\}}tj|«}tj|«}|j|d„«}tjtt    |«t    |««Dcgc]
\}}||z‘Œ c}}«}    t j ||    «|jd}
|j|
d„«}tjt    |«Dcgc]}||
z‘Œ    c}«}    t j ||    «ycc}}wcc}w)Nr
có —||zSrr©Úx1Úx2s  rú<lambda>z2TestCategorical.test_combine_add.<locals>.<lambda>‡s
€¨r°B©w€rrcó —||zSrrrRs  rrUz2TestCategorical.test_combine_add.<locals>.<lambda>Žs
€°°R±€r)ÚpdÚSeriesÚcombineÚziprr>Úassert_series_equalÚiloc) r9Ú data_repeatedÚ
orig_data1Ú
orig_data2Ús1Ús2rHr-r.ÚexpectedÚvals            rÚtest_combine_addz TestCategorical.test_combine_addsã€ñ"/¨qÓ!1ш
JÜ Y‰YzÓ "ˆÜ Y‰YzÓ "ˆØ—‘˜BÑ 6Ó7ˆÜ—9‘9Ü!$¤T¨*Ó%5´t¸JÓ7GÓ!H× I‘v˜˜1ˆQ‹UÓ Ió
ˆô     ×јv xÔ0àg‰ga‰jˆØ—‘˜CÑ!7Ó8ˆÜ—9‘9¬t°JÓ/?Ö@¨!˜a #›gÒ@ÓAˆÜ
×јv xÕ0ùó Jùò As Á9D
Ã$ DÚ    na_actionNÚignorecóX—|jd„|¬«}tj||«y)Ncó—|Srr)Úxs rrUz*TestCategorical.test_map.<locals>.<lambda>”s€ A€r)re)Úmapr>Úassert_extension_array_equal)r9rrerHs    rÚtest_mapzTestCategorical.test_map’s$€à—‘™+°Ó;ˆÜ
×'Ñ'¨°Õ5rcó’•—|}|dk(r/|jtjjd¬««t‰|||«y©NÚ__rmod__z/rmod never called when string is first argumentr3)Ú applymarkerÚpytestÚmarkÚxfailr6Útest_arith_frame_with_scalar©r9rÚall_arithmetic_operatorsÚrequestÚop_namer:s     €rrtz,TestCategorical.test_arith_frame_with_scalar—sIø€à*ˆØ jÒ  Ø × Ñ Ü— ‘ ×!Ñ!ØLð"óô ô
    ‰Ñ,¨T°7Õ;rcó’•—|}|dk(r/|jtjjd¬««t‰|||«yrn)rprqrrrsr6Útest_arith_series_with_scalarrus     €rrzz-TestCategorical.test_arith_series_with_scalar¢sIø€Ø*ˆØ jÒ  Ø × Ñ Ü— ‘ ×!Ñ!ØLð"óô ô
    ‰Ñ-¨d°GÕ<rÚsercóȕ—d|j›d}|dvr0d}tjt|¬«5|||«ddd«yt‰|||||«S#1swYyxYw)NÚ__)Ú__eq__Ú__ne__z7Unordered Categoricals can only compare equality or not)Úmatch)Ú__name__rqÚraisesÚ    TypeErrorr6Ú_compare_other)r9r{rÚopÚotherrxÚmsgr:s       €rr„zTestCategorical._compare_other¬slø€Ør—{‘{m 2Ð&ˆØ Ð.Ñ .ØKˆCÜ—‘œy°Ô4ñ  Ù4˜”÷  ð  ô‘7Ñ)¨#¨t°R¸Ó?Ð ?÷  ð  ús ³
AÁA!zCategorical overrides __repr__r ÚbigÚsmallcó&•—t‰|||«yr)r6Útest_array_repr)r9rr r:s   €rr‹zTestCategorical.test_array_reprµsø€ô    ‰Ñ  dÕ+rÚTBDÚas_indexTFcó&•—t‰|||«yr)r6Útest_groupby_extension_agg)r9rr0r:s   €rrz*TestCategorical.test_groupby_extension_aggºsø€ô    ‰Ñ*¨8Ð5FÕGr)rÚ
__module__Ú __qualname__rqrrrsr7rArIÚskiprKrMrdÚ parametrizerlrtrzrWrXr„r‹rÚ __classcell__)r:s@rr2r2MsWø„Ø ‡[[×ÑÐ:ÐÓ;ó(ó<ð(ò4ò44ð ‡[[×ÑÐ6ÐÓ7ó*ó8ð*ð  ‡[[×ÑÐ>ÐÓ?ó;ó@ð;ò1ð" ‡[[×ј[¨4°Ð*:Ó;ñ6ó<ð6ô    <ô=ð@ "§)¡)õ@ð ‡[[×ÑÐ>ÐÓ?Ø ‡[[×јV e¨WÐ%5Ó6ó,ó7ó@ð,ð ‡[[×јeÐÓ$Ø ‡[[×јZ¨$°¨Ó7óHó8ó%ôHrr2có—eZdZd„Zy)Ú Test2DCompatcóȗt|jdd««}|jd«dk(sJ‚t|jdd««}|jd«dk(sJ‚y)Nr éÿÿÿÿz
Categories)ÚreprÚreshapeÚcount)r9rÚress   rÚ test_repr_2dzTest2DCompat.test_repr_2dÁs\€ô4—<‘<  2Ó&Ó'ˆØy‰y˜Ó(¨AÒ-Ð-Ð-ä4—<‘<  AÓ&Ó'ˆØy‰y˜Ó(¨AÒ-Ð-Ñ-rN)rrr‘rrrrr–r–Às„ó.rr–)Ú__doc__rÚnumpyrrqÚpandas._configrÚpandasrWrÚpandas._testingÚ_testingr>Úpandas.api.typesrÚpandas.tests.extensionrrÚfixturerrr"r)r+r0ÚExtensionTestsr2ÚNDArrayBacked2DTestsr–rrrú<module>r©sëðñóãÛ å-ãÝÝÝ-Ý'òð‡ñóðð‡ñ$óð$ð‡ñ&óð&ð
‡ñRóðRð‡ñNóðNð‡ñCóðCôpHd×)Ñ)ôpHôf.4×,Ñ,õ.r