zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
U
¬ý°dNvã@sžddlmZmZddlZddlZddlmZmZddlm    Z    ddl
Z ddl
m Z m Z mZmZmZmZmZmZmZmZmZmZmZddlmZGdd„dƒZdS)é)ÚdateÚdatetimeN)Úis_float_dtypeÚis_integer_dtype)ÚCategoricalDtype) Ú CategoricalÚCategoricalIndexÚ DatetimeIndexÚIndexÚIntervalÚ IntervalIndexÚ
MultiIndexÚNaTÚSeriesÚ    TimestampÚ
date_rangeÚ period_rangeÚtimedelta_rangec @sreZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zej d#ed$d%d&d'ed$d%d&d(d)ed*d%d&d'g¡d+d,„ƒZd-d.„Zd/d0„Zd1d2„Zd3d4„Zej d5e d6d7d8ej g¡ejd9d:d;gd<d=d>d?d@ej ge! "dA¡e! "dB¡e#ge$dCƒe$dDƒe#ge$dCd(dEe$dDd(dEe#gg¡dFdG„ƒZ%ej dHdIdJg¡dKdL„ƒZ&dMdN„Z'ej dOdPd>d?gd>d@gg¡ej dHdIdJg¡dQdR„ƒƒZ(dSdT„Z)dUdV„Z*dWdX„Z+dYdZ„Z,d[d\„Z-d]d^„Z.ej d_d`da„e/g¡dbdc„ƒZ0ddde„Z1dfdg„Z2dhdi„Z3djdk„Z4dldm„Z5dndo„Z6dpdq„Z7drds„Z8ej d_e9e:g¡dtdu„ƒZ;ej d_e9e:g¡dvdw„ƒZ<dxdy„Z=ej dzd6d{d|gd}d{d|gg¡d~d„ƒZ>d€d„Z?d‚dƒ„Z@d„d…„ZAd†d‡„ZBej dˆdPd‰g¡dŠd‹„ƒZCej dˆdPd‰g¡dŒd„ƒZDdŽd„ZEdd‘„ZFej dHdPdIdJg¡d’d“„ƒZGd”d•„ZHd–d—„ZId˜d™„ZJdšd›„ZKdœd„ZLdždŸ„ZMd d¡„ZNdPS)¢ÚTestCategoricalConstructorscCs4tddgdddgdd}t|dd}|jjs0t‚dS)NéééT©Ú
categoriesÚorderedÚcategory©Údtype)rrrÚAssertionError)ÚselfÚcatÚres©r"úhd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/arrays/categorical/test_constructors.pyÚ8test_categorical_from_cat_and_dtype_str_preserve_ordered#s zTTestCategoricalConstructors.test_categorical_from_cat_and_dtype_str_preserve_orderedc    Cs.tjtddtdddgdW5QRXdS)Nz#Categorical input must be list-like©ÚmatchÚAÚB©r©ÚpytestÚraisesÚ    TypeErrorr©rr"r"r#Ú!test_categorical_disallows_scalar*sz=TestCategoricalConstructors.test_categorical_disallows_scalarc    Cs6d}tjt|dtt tdƒg¡ƒW5QRXdS)Nz3> 1 ndim Categorical are not supported at this timer%Zabcd)r+r,ÚNotImplementedErrorrÚnpÚarrayÚlist©rÚmsgr"r"r#Útest_categorical_1d_only/sz4TestCategoricalConstructors.test_categorical_1d_onlyc    Cs~d}t}t dddg¡}tj||dtdddg|dW5QRXtj||d"tjdddgdd    d
g|d W5QRXdS) Nz*'ordered' must either be 'True' or 'False'rrrr%r©rÚaÚbÚcr)r-r1r2r+r,rÚ
from_codes)rZexp_msgZexp_errrr"r"r#Útest_validate_ordered5sÿz1TestCategoricalConstructors.test_validate_orderedcCsVtgƒ}tgƒ}t |j|¡tgdddgd}tdddgtjd}t |j|¡dS)Nrrrr)r)rr
ÚtmÚassert_index_equalrr1Úint64)rr:Úexpectedr"r"r#Útest_constructor_emptyEs z2TestCategoricalConstructors.test_constructor_emptycCs2tgddgd}t|j ¡ƒ}|ddgks.t‚dS)NTFr))rÚsortedrÚtolistr)rr rr"r"r#Útest_constructor_empty_booleanOsz:TestCategoricalConstructors.test_constructor_empty_booleancCsNtjddddgtd}t|ƒ}tddgdd}t |j|¡|jdksJt    ‚dS)N)r)rrrF©Z tupleize_cols)
r1r2Úobjectrr
r=r>rrr©rÚvaluesÚresultr@r"r"r#Útest_constructor_tuplesUs
z3TestCategoricalConstructors.test_constructor_tuplescCsntjtdƒftdƒftdƒftdƒfdgtddd…}t|ƒ}ttdƒftdƒfgdd}t |j|¡dS)Nz
2010-01-01z
2010-01-02©r8r9réÿÿÿÿFrE)    r1r2rrFrr
r=r>rrGr"r"r#Ú!test_constructor_tuples_datetimes\s"ûø    ÷
þz=TestCategoricalConstructors.test_constructor_tuples_datetimesc    Cs^tjdddt ¡gdd}t|dd}|jr0t‚d}tjt    |d    t|d
dW5QRXdS) NrrrÚOrFr7zl'values' is not ordered, please explicitly specify the categories order by passing in a categories argument.r%T)
r1r2rÚnowrrrr+r,r-)rÚarrZfactorr5r"r"r#Útest_constructor_unsortableps 
ÿz7TestCategoricalConstructors.test_constructor_unsortablecCsnttddƒtddƒtddƒgdd}ttddƒtddƒtddƒgƒ}t|dd}t ||¡t |j|¡dS)NrrréTr7)rr r r=Úassert_categorical_equalr>r)rrIÚiiÚexpr"r"r#Útest_constructor_interval~sÿ   z5TestCategoricalConstructors.test_constructor_intervalc    CsØtjddddddgtjd}t|ƒ}t | ¡|¡t|dddgd}t | ¡|¡t|dddgd}t | ¡|¡d}tjt    |dtdd    gdd    d    gƒW5QRXtjt    |dtddgdddgƒW5QRXtddddgƒ}|j
ròt ‚tddddgƒ}t|ƒ}t  ||¡tddddgdddd
gd}t|ƒ}t  ||¡tddddgdddgd}t|ƒ}t  ||¡tddddgdddgd}t|dddgd}t | ¡| ¡¡t  |jtdddgƒ¡tddddgdddd
gd}tt|ƒƒ}t  ||¡tddddgdddgd}tt|ƒƒ}t  ||¡tddddgƒ}ttddddgƒƒ}t  ||¡tddddgdddd
gd}ttddddgƒdddd
gd}t  ||¡tdd    d tjgdd    d gd}t|jƒsÖt ‚ttjdd    d gƒ}t|jƒsøt ‚ttjdd d gƒ}t|jƒst ‚ttjd d dgƒ}t|jƒs<t ‚tdgƒ}t|jƒdksZt ‚|jddksnt ‚t|jƒdks‚t ‚|jddks–t ‚tdgƒ}t|jƒdks´t ‚|jddksÈt ‚t|jƒdksÜt ‚|jddksðt ‚t d¡$tddd    ddd    gdddgdW5QRXt d¡$tddd    ddd    gd ddgdW5QRXt d¡8tddd    ddd    gdd    d gƒtdd    gdd    d gd}W5QRXt d¡$ttjgddd d    dgddW5QRXdS)Nr8r9r:rr)ú%Categorical categories must be uniquer%rrÚdrç@çð?g@réér?Tr)r1r2Zobject_rr=Úassert_numpy_array_equalZ    __array__r+r,Ú
ValueErrorrrrSr>rr
rÚnanrrÚlenÚcodesZassert_produces_warning)rZexp_arrÚc1Úc2r5r r"r"r#Útest_constructor‡s„
          
 
 
 ( (   z,TestCategoricalConstructors.test_constructorcCsdtddddgƒ}tddddgddgd}t||jd}t ||¡tt|ƒ|jd}t ||¡dS©Nr8r9r:r))rrr=rSr)rZc0rbrcÚc3r"r"r#Ú)test_constructor_with_existing_categoriesõs  zETestCategoricalConstructors.test_constructor_with_existing_categoriesc    Cs2d}tjt|dtddgddW5QRXdS)Nz.^Parameter 'categories' must be list-like, wasr%r8r9r)r*r4r"r"r#Útest_constructor_not_sequencesz9TestCategoricalConstructors.test_constructor_not_sequencec    Cs®d}tjt|d&ttjdddgtjdddgdW5QRXtjt|d"tddddgddddgdW5QRXtjt|d"ttddgƒttdƒgdW5QRXdS)    Nú%Categorical categories cannot be nullr%r8r9r:r)ZnatZ20160101)    r+r,r^rr1r_r    rrr4r"r"r#Útest_constructor_with_nulls*&
 
þz6TestCategoricalConstructors.test_constructor_with_nullcCs\ttdƒtdƒd}t |jt|ƒ¡ttdƒtdƒd}t |jt| t¡|jd¡dS)NZaabbcaZcabr))    rr3r=rSrHrZastyperFr)rÚcir"r"r#Útest_constructor_with_indexsÿz7TestCategoricalConstructors.test_constructor_with_indexcCsªtdddgƒ}tdd„dDƒƒ}t ||¡ttdƒƒ}t ||¡t tdƒd    d
d gg¡tdddgd d„dDƒd }t ||¡tdddgtdƒd }t ||¡dS)Nrrrcss|]
}|VqdS©Nr"©Ú.0Úxr"r"r#Ú    <genexpr>$szNTestCategoricalConstructors.test_constructor_with_generator.<locals>.<genexpr>)rrrrr\r8r9r:css|]
}|VqdSrmr"rnr"r"r#rq,sr))rr=rSÚranger Z from_product)rrUr r"r"r#Útest_constructor_with_generators    z;TestCategoricalConstructors.test_constructor_with_generatorcCsNttdƒƒ}t|ƒ}tj|j|ddtdddg|d}tj|j|dddS)NrT)Úexactrrrr))r
rrrr=r>r)rÚrngr r"r"r#Ú test_constructor_with_rangeindex1s
 z<TestCategoricalConstructors.test_constructor_with_rangeindexÚdtlz1995-01-01 00:00:00r\Ús)ÚperiodsÚfreqú
US/Eastern)ryrzÚtzz1 daycCsÊt|ƒ}t|ƒ}t|ƒ|ƒ}d|j_t |j|¡t |j    t
j ddd¡|  ¡}t |jd<t|ƒ}t|ƒ| ¡ƒ}d|j_t |j|¡t
jdddddgt
jd}t |j    |¡t|ƒ}d    |ksÆt‚dS)
Nr\Úint8rrLrrrrr)rrÚtypeÚ_datarzr=r>rr]rar1ÚarangeÚcopyrZilocZdropnar2r}Úreprr)rrwrxr:r@Ús2rUrIr"r"r#Ú"test_constructor_with_datetimelike;s   
z>TestCategoricalConstructors.test_constructor_with_datetimelikecCsNtddddd}| d¡}t|ƒ}t |j|¡tt|ƒƒ}t |j|¡dS)Nz2015-01-01 10:00ÚDrr{)rzryr|)rÚ
_with_freqrr=r>rr©rÚidxrIr"r"r#Ú-test_constructor_from_index_series_datetimetz`s 
 zITestCategoricalConstructors.test_constructor_from_index_series_datetimetzcCs>t ¡}t||gƒ}|jjtks$t‚t|jdƒtks:t‚dS)Nr)rÚtodayrrrrFrr~)rÚvr r"r"r#Útest_constructor_date_objectsis z9TestCategoricalConstructors.test_constructor_date_objectscCsLtdddd}| d¡}t|ƒ}t |j|¡tt|ƒƒ}t |j|¡dS)Nz1 daysr…r©rzry)rr†rr=r>rrr‡r"r"r#Ú,test_constructor_from_index_series_timedeltaqs 
 zHTestCategoricalConstructors.test_constructor_from_index_series_timedeltacCsBtdddd}t|ƒ}t |j|¡tt|ƒƒ}t |j|¡dS)Nz
2015-01-01r…rr)rrr=r>rrr‡r"r"r#Ú)test_constructor_from_index_series_periodzs
 zETestCategoricalConstructors.test_constructor_from_index_series_periodrHrZg333333ó?gÍÌÌÌÌÌü?rrrr?rr8r9r:z2014-01z2014-02z
2014-01-01z
2014-01-02)r|cCs t|ƒ}t|ƒ}t ||¡dSrm©rr=rS)rrHr:rcr"r"r#Útest_constructor_invariant‚sz6TestCategoricalConstructors.test_constructor_invariantrTFcCs^dddg}t||d}tddddg|d}tddddg||d}t ||¡|j|ksZt‚dS)Nr9r8r:r7rr)rrr=rSrr)rrrrrIr@r"r"r#Útest_constructor_with_dtype—s
 
ÿ z7TestCategoricalConstructors.test_constructor_with_dtypec    Cs tddgdd}d}tjt|dtddgddg|dW5QRXtjt|dtddgd|dW5QRXtjt|dtddgd    |dW5QRXdS)
Nr8r9Tr7z?Cannot specify `categories` or `ordered` together with `dtype`.r%©rr©rrF)rr+r,r^r©rrr5r"r"r#Ú(test_constructor_dtype_and_others_raises¢s zDTestCategoricalConstructors.test_constructor_dtype_and_others_raisesrNcCs6tddg||dd}tddg||d}t ||¡dS)Nr8r9r©rrrrr)rrrrIr@r"r"r#Útest_constructor_str_category®sÿz9TestCategoricalConstructors.test_constructor_str_categoryc    Cs.tjtddtddgddW5QRXdS)Nz Unknown dtyper%rrZfoor)r+r,r^rr.r"r"r#Útest_constructor_str_unknown·sz8TestCategoricalConstructors.test_constructor_str_unknowncCs<tdddgt d¡t d¡gƒ}tdd„|jDƒƒs8t‚dS)NÚ1Ú0css|]}t|tjƒVqdSrm)Ú
isinstancer1Ústr_rnr"r"r#rq¾szGTestCategoricalConstructors.test_constructor_np_strs.<locals>.<genexpr>)rr1rÚallrr)rr r"r"r#Útest_constructor_np_strs»s z4TestCategoricalConstructors.test_constructor_np_strscCsVtdddgdd}tdddgƒ}t||d}tdddgdddgdd}t ||¡dS)    Nr8r9r:Tr7rXrr©rrr=rS©rrrHrIr@r"r"r#Ú,test_constructor_from_categorical_with_dtypeÀs ÿzHTestCategoricalConstructors.test_constructor_from_categorical_with_dtypecCsPtddd}tdddgƒ}t||d}tdddgdddgdd}t ||¡dS)NTr7r8r9rXrrr r¡r"r"r#Ú4test_constructor_from_categorical_with_unknown_dtypeÊs  ÿzPTestCategoricalConstructors.test_constructor_from_categorical_with_unknown_dtypecCsntdddgƒ}t|dddgddd}tdddgdddgdd}t ||¡t|dddgdd}t ||¡dS)    Nr8r9rXr:Trr—rrrGr"r"r#Ú(test_constructor_from_categorical_stringÔsÿÿ zDTestCategoricalConstructors.test_constructor_from_categorical_stringcCsftddgdddgd}tddgtdddgƒd}t ||¡tddgtdddgƒd}t ||¡dSre)rr=rSr)rr@rIr"r"r#Ú,test_constructor_with_categorical_categoriesãs
 zHTestCategoricalConstructors.test_constructor_with_categorical_categoriesÚklasscCstj|tdS)Nr)r1r2rF)rpr"r"r#Ú<lambda>íóz$TestCategoricalConstructors.<lambda>cCsJ|d|dgƒ}t|ƒ}tddgƒ}dddg}tj||d}t ||¡dS)Nr8r9rrLr)rar)rrr;r=rS)rr¦Ú nulls_fixturerHrIrrar@r"r"r#Útest_construction_with_nullís  
z7TestCategoricalConstructors.test_construction_with_nullcCs`tjtdƒ|d}tjjddd}t|ƒ}tj||d}|j    j
|j
ksJt ‚t   |j    t|ƒ¡dS)Nr\rr)Úsize)Úpdr2rrr1ÚrandomÚrandintrrr;rrrr=r>r
)rZany_numeric_ea_dtypeÚcatsrarrPr"r"r#Ú'test_from_codes_nullable_int_categoriesùs zCTestCategoricalConstructors.test_from_codes_nullable_int_categoriescCs4dddg}tjg|d}tg|d}t ||¡dSre©rr;r=rS)rr rIr@r"r"r#Útest_from_codes_emptys
 z1TestCategoricalConstructors.test_from_codes_emptyc    Csptddgd}d}tjt|dtjddg|jdW5QRXtjt|dtjddg|dW5QRXdS)Nrrr)zcodes need to be between r%r©rr+r,r^rr;rr•r"r"r#Ú"test_from_codes_too_few_categories    s z>TestCategoricalConstructors.test_from_codes_too_few_categoriesc    Csltddgd}d}tjt|dtjdg|jdW5QRXtjt|dtjdg|dW5QRXdS)Nrrr)ú$codes need to be array-like integersr%r8rr³r•r"r"r#Útest_from_codes_non_int_codess z9TestCategoricalConstructors.test_from_codes_non_int_codesc    Cs8tjtdd tjdddgdddgdW5QRXdS)    NrWr%rrrr8r9r)©r+r,r^rr;r.r"r"r#Ú%test_from_codes_non_unique_categoriesszATestCategoricalConstructors.test_from_codes_non_unique_categoriesc    Cs:tjtdd"tjdddgddtjgdW5QRXdS)    Nrir%rrrr8r9r))r+r,r^rr;r1r_r.r"r"r#Ú test_from_codes_nan_cat_includedsz<TestCategoricalConstructors.test_from_codes_nan_cat_includedc    Csvtdddgd}d}tjt|dtjddd    g|jdW5QRXtjt|dtjddd    g|d
W5QRXdS) Nr8r9r:r)z3codes need to be between -1 and len\(categories\)-1r%éþÿÿÿrrrr³r•r"r"r#Útest_from_codes_too_negative!s  z8TestCategoricalConstructors.test_from_codes_too_negativecCshtdddgd}tdddgdd}tjddd    g|jd}t ||¡tjddd    g|d
}t ||¡dS) Nr8r9r:r)Fr7rrrr)rrr;rr=rS)rrrUr!r"r"r#Útest_from_codes)s  z+TestCategoricalConstructors.test_from_codescCsBtddgdddgd}tjddg|dddgƒd}t ||¡dS)Nr8r9r:r)rrr±)rr¦r@rIr"r"r#Ú+test_from_codes_with_categorical_categories2szGTestCategoricalConstructors.test_from_codes_with_categorical_categoriesc    Cs8tjtdd t ddg|dddgƒ¡W5QRXdS)NrWr%rrr8r9r·)rr¦r"r"r#Ú6test_from_codes_with_non_unique_categorical_categories:szRTestCategoricalConstructors.test_from_codes_with_non_unique_categorical_categoriesc    Csrddtjg}tdddgd}tjtddtj||jdW5QRXtjtddtj||d    W5QRXdS)
Nrrr8r9r:r)rµr%r)    r1r_rr+r,r^rr;r)rrarr"r"r#Útest_from_codes_with_nan_code?s  z9TestCategoricalConstructors.test_from_codes_with_nan_coderarYrgš™™™™™ñ?c    Cshtdddgd}d}tjt|dt ||j¡W5QRXtjt|dtj||dW5QRXdS)Nr8r9r:r)rµr%rr³)rrarr5r"r"r#Útest_from_codes_with_floatHs z6TestCategoricalConstructors.test_from_codes_with_floatc    Csxd}tjt|d&tjddgddgtddgƒdW5QRXtjt|d"tjddgdtddgƒd    W5QRXdS)
NzCannot specifyr%rrr8r9r“Tr”)r+r,r^rr;rr4r"r"r#Ú!test_from_codes_with_dtype_raisesTs
ÿ
ÿz=TestCategoricalConstructors.test_from_codes_with_dtype_raisesc    Cs0d}tjt|dt ddg¡W5QRXdS)NzBoth were Noner%rrr·r4r"r"r#Útest_from_codes_neither`sz3TestCategoricalConstructors.test_from_codes_neithercCsLtjddgdd}ddg}tj||d}tj| t¡|d}t ||¡dS)NrrÚInt64rr8r9r))r¬r2rr;Zto_numpyÚintr=rS)rrarrIr@r"r"r#Ú!test_from_codes_with_nullable_intes
z=TestCategoricalConstructors.test_from_codes_with_nullable_intc    CsJtjddgdd}ddg}d}tjt|dtj||dW5QRXdS)    NrrÃrr8r9zcodes cannot contain NA valuesr%r))r¬r2r+r,r^rr;)rrarr5r"r"r#Ú+test_from_codes_with_nullable_int_na_raisesns
zGTestCategoricalConstructors.test_from_codes_with_nullable_int_na_raisesrrcCsHddg}tjddddgdd}t |||¡}t ||¡}t ||¡dS)Nr8r9rrÚi8r©r1r2rÚ_from_inferred_categoriesr;r=rS©rrr¯rarIr@r"r"r#Útest_from_inferred_categoriesvs
 z9TestCategoricalConstructors.test_from_inferred_categoriescCsTddg}tjddddgdd}t |||¡}t ddddgddg¡}t ||¡dS)Nr9r8rrrÇrrÈrÊr"r"r#Ú#test_from_inferred_categories_sorts~s
z?TestCategoricalConstructors.test_from_inferred_categories_sortscCsldddg}tjddddgdd}td    ddgd
d }t |||¡}tddddgd    ddgd
d }t ||¡dS) Nr8r9rXrrrrÇrr:Tr7r)r1r2rrrÉr=rS©rr¯rarrIr@r"r"r#Ú#test_from_inferred_categories_dtype†s
 
ÿz?TestCategoricalConstructors.test_from_inferred_categories_dtypecCs\dddg}tjddddgdd}tddgƒ}t |||¡}tdddtjgƒ}t ||¡dS)    NršÚ2ÚbadrrrrÇr)r1r2rrrÉr_r=rSrÍr"r"r#Ú%test_from_inferred_categories_coercess 
 zATestCategoricalConstructors.test_from_inferred_categories_coercescCs(tdddg|d}|jt|ƒks$t‚dS)Nrrrr7)rrÚboolr)rrr r"r"r#Útest_construction_with_ordered˜sz:TestCategoricalConstructors.test_construction_with_orderedcCs@dddg}t|ƒ}t |jt|ƒ¡t t |¡t |¡¡dS)Nrry@ð?)rr=r>rr
r]r1r2)rrHrbr"r"r#Útest_constructor_imaginaryžs
z6TestCategoricalConstructors.test_constructor_imaginarycCs<ttjddddgtdƒ}tdddgƒ}|j |¡s8t‚dS)Nr:rK)r9r8r)rr1r2rFr
rÚequalsr)rr:Zexpected_indexr"r"r#Ú"test_constructor_string_and_tuples¤sz>TestCategoricalConstructors.test_constructor_string_and_tuplescCs¬tjdddd}t||d}tjddd}t |j|¡t |j    |¡t|ƒ}t |j|¡t |j    |¡tt
|ƒƒ}t |j|¡t |j    |¡tt
|ƒt
|ƒd}t |j|¡t |j    |¡|  dddg¡}t||d}t |jtj dddgdd¡t |j    |¡tjd    d
d d}t||d}tj d    d d gdd}t |j|¡t |j    |¡t tddƒtddƒgƒ}t||d}tj ddgdd}t |j|¡t |j    |¡dS)Nré
©ryr)r}rrréé ré    rL)r¬Zinterval_rangerr1r€r=r]rar>rr3Ztaker2r r )rrˆr Zexpected_codesrHr"r"r#Ú test_intervalªs8     z)TestCategoricalConstructors.test_intervalcCsXtjj |gd¡}t|ƒ}|j|jjks.t‚tttj    tj    g|jdƒ}t
  ||¡dS)Nrr) r¬ZarraysZ StringArrayÚ_from_sequencerrrrrZNAr=rS)rr©rPrIr@r"r"r#Ú)test_categorical_extension_array_nullableÔs
zETestCategoricalConstructors.test_categorical_extension_array_nullablecCsXtt d¡ d¡ƒ}tj|ddd}|j|jks4t‚tj|ddd}t ||¡rTt‚dS)Nr\rF)rrT)    rr1r€ÚrepeatrÝÚ_codesrr=Z shares_memory)rr rIr"r"r#Útest_from_sequence_copyÜs
z3TestCategoricalConstructors.test_from_sequence_copycCsBt d¡ d¡}|ddd… ¡}t||d}||k ¡s>t‚dS)Nr×zM8[D]rr))r1r€Úviewrrržr)rrrHr r"r"r#Ú$test_constructor_datetime64_non_nanoçs z@TestCategoricalConstructors.test_constructor_datetime64_non_nanocCs2tddd}|j}t|ƒ}|jj}||ks.t‚dS)Nz
2016-01-01r\rØ)rrzrrr)rZdtir@r rIr"r"r#Útest_constructor_preserves_freqîs
 z;TestCategoricalConstructors.test_constructor_preserves_freq)OÚ__name__Ú
__module__Ú __qualname__r$r/r6r<rArDrJrMrQrVrdrgrhrjrlrsrvr+ÚmarkZ parametrizerrr„r‰rŒrŽrr1r2r_r¬ZPeriodrrr‘r’r–r˜r™rŸr¢r£r¤r¥r3rªr°r²r´r¶r¸r¹r»r¼rrr½r¾r¿rÀrÁrÂrÅrÆrËrÌrÎrÑrÓrÔrÖrÜrÞrárãrär"r"r"r#r"s¶
    n     
  ýþ
         
 
ýúþ
 
 
 
 
 
 
        
 
    
     
 
 
 
* r)rrÚnumpyr1r+Zpandas.core.dtypes.commonrrZpandas.core.dtypes.dtypesrZpandasr¬rrr    r
r r r rrrrrrZpandas._testingZ_testingr=rr"r"r"r#Ú<module>s <