gL i;*ddlZddlZddlmZddlmZmZddl m Z GddZ ejjdddgd Zd Zd Zd Zd ZdZdZdZy)N)join) inner_joinleft_outer_joincfeZdZejj dgddZdZdZdZ y) TestIndexerdtype)int32int64float32float64objectc0tj}tjd|}tjdd|}tjg|}|||\}}}t |tj sJt |tj sJt |tj sJtj|tjd|tjgdtj} tj|| tjgdtj} tj|| |||\}}}tj||tjgdtj} tj|| tjgdtj} tj|| |||\}}}tj||tjgdtj} tj|| tjgdtj} tj|| y) Nr)rrr)rrrrr)rrr)rrr) libjoinouter_join_indexernparangearray isinstancendarraytmassert_numpy_array_equalintp) selfrindexerleftrightemptyresultlindexerrindexerexps a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/tests/libs/test_join.pytest_outer_join_indexerz#TestIndexer.test_outer_join_indexers,,yy%( !Qe,5)%,T5%9"(&"**---(BJJ///(BJJ/// ##FBIIau,EFhh(8 ##Hc2hh(8 ##Hc2%,UE%:"( ##FE2hh|2773 ##Hc2hhy0 ##Hc2%,T5%9"( ##FD1hhy0 ##Hc2hh|2773 ##Hc2c,tjgdtj}tjgdtj}d}t|||\}}|j d}|j d}tjgd}tjgd} |j |}d ||d k(<|j | }d || d k(<t j||d t j||d y) N rrrrrrrrrrrrrrrrrrr mergesortkind)rrrrrrr.r.r.rrrr2r3r4 )rrrrrrrrrrrrr.rr.rr.rrrrF) check_dtyperrrrargsorttakerr rr!r" max_grouplsrsexp_lsexp_rsexp_liexp_ris r(test_cython_left_outer_joinz'TestIndexer.test_cython_left_outer_join0sxx9I.bgg>  ui8B;/K0WX J V$!v|V$!v| ##BEB ##BEBr*c$tjgdtj}tjgdtj}d}t|||\}}|j d}|j d}tjgd}tjgd} |j |}d ||d k(<|j | }d || d k(<t j||t j||y) Nr,rr-rr/r0)rrrrr.rrr.rrr.rr2r3r4r2r3r4r)rrrrrrrrrrrrr.r.r.rrrr2rr8) rr!r"r<r>r=r?r@rArBs r(test_cython_right_outer_joinz(TestIndexer.test_cython_right_outer_joinHsxx9I.bgg>  i8B;/K0  0STV$!v|V$!v| ##B/ ##B/r*c$tjgdtj}tjgdtj}d}t|||\}}|j d}|j d}tjgd}tjgd} |j |}d ||d k(<|j | }d || d k(<t j||t j||y) Nr,r)rrrr.rrrr.rr/r0)rrrrrrr.r.r.rrrr2r2r3r3r4r4)rrrrrrrrrrrrr.rr.rr.rr)rrrrr9r:rrr;s r(test_cython_inner_joinz"TestIndexer.test_cython_inner_joinvsxx9I1A D%3B;/K0PQPQV$!v|V$!v| ##B/ ##B/r*N) __name__ __module__ __qualname__pytestmark parametrizer)rCrErGr*r(rr s: [[C33>C0,0\0r*rreadonlyTFctjgdtj}tjgdtj}|r$|jd|jdt j ||}tjgdtj }tj||y)Nrrrr.rr)rrrr.r.F)write)rrrrr) rrr setflagsrleft_join_indexer_uniquerrr)rOabr$expecteds r(test_left_join_indexer_uniquerXs 1A 1A      - -a 3Fxxrww7H1r*ctjgdtj}tjddgtj}d}tj|||d\}}tj t |tj}tjt |tj }d||dk(<d||dk(<tj||tj||y) N)drrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.F)sortr) rrrrrrlenonesrr)r!r" max_groupslidxridxexp_lidxexp_ridxs r(test_left_outer_join_bugrbs 88e LggOh DT HHaV277 +EJ((ujuMJD$yyT"''2HD 11HHTQYHTQYh/h/r*cjtjgdtj}tjgdtj}tj||\}}}tjddgtj}t j ||tjddgtj}tjddgtj}t j ||t j ||tjdgtj}tjdgtj}tj||\}}}t j|tjdgtjt j|tjd gtjt j|tjd gtjy) NrQrrrrr3r5rrrr.rr) rrr rinner_join_indexerrassert_almost_equalrrrUrVindexaresbres index_expaexpbexps r(test_inner_join_indexerrnsc 1A 1A221a8E4!Qrxx0I5), 88QF"'' *D 88QF"'' *D4&4& !BHH%A !BHH%A221a8E4rxx288'DEbhhs"''&BCbhhs"''&BCr*cjtjgdtj}tjgdtj}tj||\}}}tjgdtj}t j ||tjgdtj}tjgdtj}t j ||t j ||tjdgtj}tjdgtj}tj||\}}}t j|tjdgtjt j|tjdgtjt j|tjdgtjy) NrQrrd)rrrrr.rr3r5)rrrrrr.rr)rrrrrrrr.rr) rrr rrrrfrrrgs r(r)r),sZ 1A 1A221a8E41BI5), 88/rww ?D 88/rww ?D4&4& !BHH%A !BHH%A221a8E4rxx288'DEbhhs"''&BCbhhs"''&BCr*ctjgdtj}tjgdtj}tj||\}}}t j ||tjgdtj}tjgdtj}t j ||t j ||tjdgtj}tjdgtj}tj||\}}}t j|tjdgtjt j|tjdgtjt j|tjdgtjy)NrQrrd)rrrrr.)rrrrrrr) rrr rleft_join_indexerrrfrr)rUrVrhrirjrlrms r(test_left_join_indexerrrCsD 1A 1A11!Q7E45!$ 88O277 3D 88&bgg 6D4&4& !BHH%A !BHH%A11!Q7E4rxx288'DEbhhs"''&BCbhhs"''&BCr*cBtjgdtj}tjgdtj}tj||\}}}tjgdtj}t j ||tjgdtj}t j ||tjgdtj}t j ||yNrrrrrrrrr3r5)rrrrr3r5)rrrrrr.)rrrrrr)rrr rrqrrfridxidx2resr^r_exp_resr`ras r(test_left_join_indexer2r|Ys ((rsv ( }0}0@dE]3 24 2w0tD.D.D, + + +r*