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
U
¬ý°dç ã@s8UddlmZddlmZddlZddlZddlZddl    m
Z dd„e j DƒZ dgee ƒZded<e d    d„e jDƒ7Z ed
d
g7Ze ejd d d dgd dg7Z ed g7Zejee eƒdd„e Dƒddd„ƒZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zej  d%d&d'd(g¡d)d*„ƒZ!dS)+é)Ú annotations)ÚAnyNcCs"g|]}tjddddg|d‘qS)éééN©Údtype©ÚpdÚarray©Ú.0r©rúad:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/arrays/masked/test_arithmetic.pyÚ
<listcomp> srrz    list[Any]ÚscalarscCs"g|]}tjddddg|d‘qS)gš™™™™™¹?皙™™™™É?g333333Ó?Nrr    r rrrrsrTFÚbooleanrcCsg|] }|jj‘qSr)rÚname)r Úarrrrs)ÚparamsÚidscCs|jS)z¶Fixture returning parametrized (array, scalar) tuple.
 
    Used to test equivalence of scalars, numpy arrays with array ops, and the
    equivalence of DataFrame and Series ops.
    )Úparam)ÚrequestrrrÚdatasrcCs$t|jtjƒr d|kr t d¡dS)NÚsubz$subtract not implemented for boolean)Ú
isinstancerr
Z BooleanDtypeÚpytestÚskip©rZop_namerrrÚ
check_skip sr cCs |jjdko| d¡ d¡dkS)NÚbÚ_Úr)ÚpowÚtruedivÚfloordiv)rÚkindÚstripÚlstriprrrrÚis_bool_not_implemented%sr*c
CsÈ|\}}t |¡}t||ƒtj|gt|ƒ|jd}||j |¡fD]|}t||ƒr¢d}t    j
t |d|||ƒW5QRXt    j
t |d|||ƒW5QRXqF|||ƒ}|||ƒ}t  ||¡qFdS©Nrú-operator '.*' not implemented for bool dtypes©Úmatch) ÚtmÚget_op_from_namer r
r ÚlenrÚtyper*rÚraisesÚNotImplementedErrorÚassert_extension_array_equal)rÚall_arithmetic_operatorsÚscalarÚopÚ scalar_arrayÚmsgÚresultÚexpectedrrrÚ"test_array_scalar_like_equivalence2s
 
 
 
 
r=c
    CsÌ|\}}t |¡}t||ƒtj}tjtjgt|ƒ|jd}|j     ¡}t
||ƒrŒd}t j t |d|||ƒW5QRXt ||j¡dS|||ƒ}t ||j¡|||ƒ}    t ||j¡t ||    ¡dSr+)r/r0r r
ZNAr r1rZ_maskÚcopyr*rr3r4Zassert_numpy_array_equalr5)
rr6r"r8r7r9Úmaskr:r;r<rrrÚ test_array_NAGs"
 
 
 
 
 
r@c        CsÆ|\}}t |¡}t||ƒtj|gt|ƒ|jjd}tj||jd}t    ||ƒr¢d}t
j t |d|||ƒW5QRXt
j t |d|||ƒW5QRXdS|||ƒ}|||ƒ}t  ||¡dSr+)r/r0r Únpr r1rÚ numpy_dtyper
r*rr3r4r5)    rr6r7r8Z numpy_arrayZpd_arrayr:r;r<rrrÚtest_numpy_array_equivalencecs
 
 
 
 
rCc    Cs²|\}}t |¡}t||ƒt d|i¡}t||ƒr„d}tjt|d|||ƒW5QRXtjt|d|||ƒW5QRXdS|||ƒ}t d|||ƒi¡}t     ||¡dS)NÚAr,r-)
r/r0r r
Ú    DataFramer*rr3r4Zassert_frame_equal)rr6r7r8Zdfr:r;r<rrrÚ
test_frame|s
 
 
 
rFc
 
CsÞ|\}}t |¡}t||ƒt |¡}|tj|gt|ƒ|jj    dtj|gt|ƒ|jdtj|gt|ƒ|jdg}|D]^}t
||ƒr²d}t j t |d|||ƒW5QRXqz|||ƒ}t |||ƒ¡}    t ||    ¡qzdSr+)r/r0r r
ÚSeriesrAr r1rrBr*rr3r4Úassert_series_equal)
rr6r7r8ÚserZothersÚotherr:r;r<rrrÚ test_series‘s"
 
 
ü
 
rKc    Cst|\}}|}t||ƒ}|t d|i¡ƒ}|tks4t‚d}tjt|d$|t     t
|ƒ¡  dt
|ƒ¡ƒW5QRXdS)NrDz(can only perform ops with 1-d structuresr-éÿÿÿÿ) Úgetattrr
rEÚNotImplementedÚAssertionErrorrr3r4rAZaranger1Zreshape)rr6r"r8Zopar;r:rrrÚtest_error_invalid_object¯s
 rPc
CsÖ|\}}t |¡}|gt|ƒd}t}d ddg¡}|jjdkrZ| d¡dkrZt}d}nt    ||ƒrld    }t
}|t   |¡fD]V}t j||d
|||ƒW5QRXt |¡}t j||d
|||ƒW5QRXqzdS) Nrú|zBoperands could not be broadcast together with shapes \(3,\) \(4,\)zBoperands could not be broadcast together with shapes \(4,\) \(3,\)r!r")rZrsubzˆnumpy boolean subtract, the `\-` operator, is not supported, use the bitwise_xor, the `\^` operator, or the logical_xor function insteadr,r-)r/r0r1Ú
ValueErrorÚjoinrr'r(Ú    TypeErrorr*r4rAr rr3r
rG)rr6r7r8rJÚerrr:ÚsrrrÚtest_error_len_mismatch¾s,
þÿÿ
 
rWr8Ú__neg__Ú__abs__Ú
__invert__c    CsÒ|\}}t |¡}|dkr¢|jjdkr¢d}tjt|dt||ƒƒW5QRXtjt|dt||ƒƒW5QRXtjt|dt|j|ƒƒW5QRXdSt||ƒƒ}|j    dd}d|d<t
  ||¡dS)NrZÚfz0ufunc 'invert' not supported for the input typesr-T)Údeepr) r
rGrr'rr3rTrMÚ_datar>r/rH)rr8r"rIr:r;r<rrrÚ%test_unary_op_does_not_propagate_maskâs
  r^)"Ú
__future__rÚtypingrÚnumpyrArZpandasr
Zpandas._testingZ_testingr/ZALL_INT_EA_DTYPESZarraysr1rÚ__annotations__ZFLOAT_EA_DTYPESr ZfixtureÚziprr r*r=r@rCrFrKrPrWÚmarkZ parametrizer^rrrrÚ<module>s2    
 
     $