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
U
­ý°d¸#ã@s^ddlmZddlZddlZddlZddlmZmZddlm    Z
ddl m Z Gdd„dƒZ dS)é)ÚdatetimeN)ÚIndexÚSeries)Ú    safe_sortc @sîeZdZej dddddg¡dd„ƒZdd    „Zd
d „Zej d e    j
e e g¡d d„ƒZ dd„Zdd„Zdd„Zdd„Zej d e    j
e e g¡dd„ƒZdd„Zdd„Zdd„Zej ded d!gƒd gfed d!d"gƒd"d gfg¡d#d$„ƒZd%d&„Zd'd(„Zej d)de    j
d*d+d,d-gd.efd/gd0d1fde    j
d*d,d+d-gd.efd/gd0d2fde    j
d*d,d3d+d-d4gd.efd/gd0d2fg¡d5d6„ƒZej d7d8d9ggg¡ej d:d9d8ggg¡ej d;d<d=d>g¡d?d@„ƒƒƒZej dAddBd ggddBdCd dDggg¡dEdF„ƒZd2S)GÚTestIndexSetOpsÚmethodÚunionÚ intersectionÚ
differenceÚsymmetric_differencec    CsZtddgƒ}tddgƒ}tjtddt||ƒ|ddW5QRXt||ƒ|dddS)    NÚaÚbÚczThe 'sort' keyword only takes©Úmatché©ÚsortT)rÚpytestÚraisesÚ
ValueErrorÚgetattr)ÚselfrÚidx1Úidx2©rúbd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/indexes/base_class/test_setops.pyÚtest_setops_sort_validations
  z+TestIndexSetOps.test_setops_sort_validationcCs tdddgtd}| |dd…¡}|dd…}t ||¡| |dd…ddd…¡}t ||¡|j|dd…dd}|}t ||j¡|j|dd…dd}t ||¡|j|dd…ddd…dd}t ||j¡|j|dd…ddd…dd}t ||¡dS)Néré©Zdtypeéÿÿÿÿr)    rÚobjectr    ÚtmÚassert_index_equalZ_unionZassert_numpy_array_equalÚvaluesr)rÚidxÚresultÚexpectedrrrÚ!test_setops_preserve_object_dtypes      z1TestIndexSetOps.test_setops_preserve_object_dtypecCsZtddddddgƒ}|dd…}|dd…}| |¡}tddddddgƒ}t ||¡dS©    Nrr rr rrré)rrr#r$©rÚindexÚfirstÚsecondr'r(rrrÚtest_union_base7s   
zTestIndexSetOps.test_union_baseÚklasscCsPtddddddgƒ}|dd…}|dd…}| ||jƒ¡}t ||¡sLt‚dSr*)rrr%r#Ú equalContentsÚAssertionError)rr1r-r.r/r'rrrÚtest_union_different_type_baseAs
  z.TestIndexSetOps.test_union_different_type_basec    Cs¤tdt d¡gƒ}t t¡| |dd…¡}W5QRXt ||¡t t¡|j|dd…dd}W5QRXt ||¡|j|dd…dd}t ||¡dS)NrÚ2000rF)rÚpdÚ    Timestampr#Zassert_produces_warningÚRuntimeWarningrr$)rr&r'rrrÚ"test_union_sort_other_incomparableLs     z2TestIndexSetOps.test_union_sort_other_incomparablec    CsFtdt d¡gƒ}tjtdd|j|dd…ddW5QRXdS)Nrr5z.*rTr)rr6r7rrÚ    TypeErrorr©rr&rrrÚ'test_union_sort_other_incomparable_true^sz7TestIndexSetOps.test_union_sort_other_incomparable_truecCs6tdddgƒ}tdddgƒ}t |j|dd|¡dS)Nrr r Tr©rr#r$r    )rr&Zsorted_rrrÚ!test_intersection_equal_sort_truecsz1TestIndexSetOps.test_intersection_equal_sort_truecCsntddddddgƒ}|dd…}|dd…}|dkrBtdddgƒn tdddgƒ}|j||d    }t ||¡dS©
Nrr rr rrr+rr©rr    r#r$)rrr-r.r/r(r'rrrÚtest_intersection_basehs   $z&TestIndexSetOps.test_intersection_basecCsTtddddddgƒ}|dd…}|dd…}|j||jƒ|d    }t ||¡sPt‚dSr?)rr    r%r#r2r3)rr1rr-r.r/r'rrrÚ%test_intersection_different_type_basers
  z5TestIndexSetOps.test_intersection_different_type_basecCs4tdddgƒ ddg¡}tddgƒ}t ||¡dS)Nrr r r@)rr'r(rrrÚtest_intersection_nosort|s z(TestIndexSetOps.test_intersection_nosortcCs>tdddgƒ}t |j|dd|¡t |j|dd|¡dS)Nrr r Frr=r;rrrÚtest_intersection_equal_sortsz,TestIndexSetOps.test_intersection_equal_sortcCsTtdddƒtdddƒg}t|td}tdgtd}|j||d}t|ƒdksPt‚dS)    NiÜré    ér Zaarr)rrr"r    Úlenr3)rrZdt_datesÚi1Úi2r'rrrÚtest_intersection_str_dates†s
 z+TestIndexSetOps.test_intersection_str_dateszindex2,expected_arrÚBÚDÚAcCsJtddddgƒ}t|dd}|j||d}|dkr:| ¡}t ||¡dS)NrMrKÚCr"r r)rr    Z sort_valuesr#r$)rÚindex2Z expected_arrrÚindex1r(r'rrrÚ*test_intersection_non_monotonic_non_uniques  z:TestIndexSetOps.test_intersection_non_monotonic_non_uniquecCsjtddddddgƒ}|dd…}|dd…}| ||¡}tdddgƒ}|dkrZtt|ƒƒ}t ||¡dS©    Nrr rr rrér)rr
rr#r$)rrr-r.r/r'r(rrrÚtest_difference_baseœs    z$TestIndexSetOps.test_difference_basecCsXtddddddgƒ}|dd…}|dd…}| |¡}tdddddgƒ}t ||¡dSrR)rr r#r$r,rrrÚtest_symmetric_difference¨s   
z)TestIndexSetOps.test_symmetric_differencezmethod,expected,sort©rrM©rrM©rrK©rrKÚnum©ZletZa1r FN©rrN©rrNcCs€ttjddddgdtfdgdƒ}ttjdddddd    gdtfdgdƒ}t||ƒ||d
}|jd ksht‚t|ƒ}t ||¡dS) NrVrWrXrYrZr[r r\r]rr)    rÚnpÚarrayÚintrÚndimr3r#r$)rrr(rrPrOr'rrrÚtest_tuple_union_bug²s 
 
þÿ
þÿz$TestIndexSetOps.test_tuple_union_bugÚ
first_listr r Ú second_listz&first_name, second_name, expected_name)rMrKN)NrKN)rMNNc CsŽt||d}t||d}|j||d}    t|ƒ |¡}
|dkrrt|ƒdkrrt|ƒdkrrtt|
ƒ|d} t |    | ¡nt|
|d} t |    | ¡dS)N)Únamerr)rrÚsetrGÚsortedr#r$r2) rrcrdZ
first_nameZ second_nameZ expected_namerr.r/rÚvalsr(rrrÚtest_union_name_preservationãs        z,TestIndexSetOps.test_union_name_preservationzdiff_type, expectedrrrNcCsFtddddgƒ}tddddgƒ}t||ƒ|ƒ}t|ƒ}t ||¡dS)NrrrMrKrrN)rrr#r$)rZ    diff_typer(rrr'rrrÚtest_difference_object_typeùs
z+TestIndexSetOps.test_difference_object_type)Ú__name__Ú
__module__Ú __qualname__rÚmarkZ parametrizerr)r0r^r_rÚlistr4r9r<r>rArBrCrDrJrrQrTrUr`rbrirjrrrrrs~
ÿ
 
 
 
 
 
 
        &þ
     
 
 
þú    
 
þú    
þúïþ
þþr)rÚnumpyr^rZpandasr6rrZpandas._testingZ_testingr#Zpandas.core.algorithmsrrrrrrÚ<module>s