'Vfi rdZddlZddlZddlmZmZmZmZddl m Z ddl m Z mZd dZd dZdd efd Zd ZdS)z) Assertion helpers for arithmetic tests. N) DataFrameIndexSeriesarray) BooleanArrayNumpyExtensionArray cannot addctjt|5||zdddn #1swxYwYtjt|5||zddddS#1swxYwYdS)z Helper to assert that left and right cannot be added. Parameters ---------- left : object right : object msg : str, default "cannot add" matchNpytestraises TypeErrorleftrightmsgs Mc:\PYTHON\DbComparer\venv\Lib\site-packages\pandas/tests/arithmetic/common.pyassert_cannot_addrs y , , , u  y , , ,  s.22A''A+.A+ctjt|5||zdddn #1swxYwYtjt|5||zdddn #1swxYwYtjt|5||z dddn #1swxYwYtjt|5||z ddddS#1swxYwYdS)z Helper to assert that left and right can be neither added nor subtracted. Parameters ---------- left : object right : object msg : str or None, default None r Nr rs rassert_invalid_addsub_typer$s y , , , u  y , , ,   y , , , u  y , , ,  sB.22A&&A*-A* BB"%B"CCCFis_cmpct|tst|trtSt|tst|tr*|r!t|tr tjStSt|tst|tr|r tjStSt jS)z Get the box to use for 'expected' in an arithmetic or comparison operation. Parameters left : Any right : Any is_cmp : bool, default False Whether the operation is a comparison method. ) isinstancerrrnprtmto_array)rrrs rget_upcast_boxr8s$ ""j &B&B$:eV#<#<  ju-- 8O $*UE":":  8O ;c|ttfvr|n tj}d}|}t|tr!t|tr tj}|||k}|tj|jtj}tj |||||k}tj ||||||k}tj |||||k}tj |||d gd}tj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kdddn #1swxYwYtj t|5||kddddS#1swxYwYdS)a Assert that comparison operations with mismatched types behave correctly. Parameters ---------- left : np.ndarray, ExtensionArray, Index, or Series right : object box : {pd.DataFrame, pd.Series, pd.Index, pd.array, tm.to_array} ct|tr|jSt|tr|t S|SN)rr_ndarrayrastypebool)xs rxbox2z(assert_invalid_comparison..xbox2`sF a, - - :  a & & "88D>> !r )dtype|)zInvalid comparison betweenzCannot compare typeznot supported betweenzinvalid type promotionzThe DTypes and do not have a common DType. For example they cannot be stored in a single array unless the dtype is `object`.r N)rrrrrzerosshapebool_r assert_equaljoinrrr) rrboxxboxr(rev_boxresultexpectedrs rassert_invalid_comparisonr5QseU^++33DG%JtV$<$<( U45= ! !FtBHV\:::;;HOFH%%% U5D= ! !FOFGGH--... U45= ! !FOFXI&&& U5D= ! !FOFGGXI../// ((   C y , , , u  y , , ,   y , , , u  y , , ,   y , , ,   y , , ,   y , , ,   y , , ,  sE11E58E5F**F.1F.G##G'*G' HH #H III;JJJ4KK K -LLL)r r#)F)__doc__numpyrrpandasrrrrpandas._testing_testingrpandas.core.arraysrrrrr&rr5r rr=s       (2JJJJJr