gL idZddlZddlZddlmZddlZddlm Z ddl m Z ddl mZejdgdZejd Zejd Zejd Zejd Zejd ZejdZGddej.ZGddej2Zy)aj This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal tweaks should be applied to get the tests passing (by overwriting a parent method). Additional tests should either be added to one of the BaseExtensionTests classes (if they are relevant for the extension interface for all dtypes), or be added to the array-specific tests in `pandas/tests/arrays/`. N)DatetimeTZDtype) DatetimeArray)basez US/Central)paramsc0td|jS)Nns)unittz)rparam)requests j/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/tests/extension/test_datetime.pydtypers  77cttjtjdd|j|}|S)N2000d)periodsr r)r_from_sequencepd date_ranger )rdatas r rr s/  ' ' fcehh7u D Krc^tjtjddgd|S)NNaT 2000-01-01datetime64[ns]r)rrnparrayrs r data_missingr(s+  ' ' %&.>?u rctjd}tjd}tjd}tjt j |||gd|S)Nr 2000-01-02 2000-01-03rrr Timestamprrrr)rabcs r data_for_sortingr(/sV \"A \"A \"A  ' ' !Q"235 rctjd}tjd}tjt j |d|gd|S)Nrr!rrrr#)rr%r&s r data_missing_for_sortingr*9sH \"A \"A  ' ' !UA&67u rc tjd}tjd}tjd}d}tjt j ||||||||gd|S)z_ Expected to be like [B, B, NA, NA, A, A, B, C] Where A < B < C and NA is missing rr!r"rrrr#)rr%r&r'nas r data_for_groupingr-Bsh \"A \"A \"A B  ' ' !QB1a+3CDE rc d}|S)Nc2|tjuxr||uSN)rr)r%r&s r cmpzna_cmp..cmpTsBFF{%qAv%r)r1s r na_cmpr3Rs& JrceZdZfdZdedefdZdedefdZejjdddgfd Z fd Z ejjd d d gdZ dejdedeffd ZxZS)TestDatetimeArrayc0|dvryt||||S)N)__sub____rsub__)super_get_expected_exception)selfop_nameobjother __class__s r r:z)TestDatetimeArray._get_expected_exception\s# - -w.wUCCrr<returnc |dvS)N)cummincummaxr2)r;serr<s r _supports_accumulationz(TestDatetimeArray._supports_accumulationas...rc |dvS)N)minmaxmedianmeanstdanyallr2)r;r=r<s r _supports_reductionz%TestDatetimeArray._supports_reductiondsOOOrskipnaTFc|}d|d}tjt|d5t||||dddy#1swYyxYw)N'z8' with datetime64 dtypes is deprecated and will raise inF)matchcheck_stacklevel)tmassert_produces_warning FutureWarningr9test_reduce_series_boolean)r;rall_boolean_reductionsrOmethmsgr?s r rWz,TestDatetimeArray.test_reduce_series_booleangsY%$OP  ' ' u  U G .t5KV T U U Us AA cF|jd}t| |yr0) _with_freqr9test_series_constructor)r;rr?s r r]z)TestDatetimeArray.test_series_constructorpst$ '-r na_actionNignorecX|jd|}tj||y)Nc|Sr0r2)xs r z,TestDatetimeArray.test_map..wsAr)r^)maprTassert_extension_array_equal)r;rr^results r test_mapzTestDatetimeArray.test_mapus$+; ''5rrDc`|dvr|jd}t||}t||}||}||}|dvr.|jj} t j || }nt j |}tj||yt |)|||S)N)rIrJrKint64)rO)rJrI)r ) astypegetattrrr rr$ TimedeltarTassert_almost_equalr9 check_reduce) r;rDr<rOaltres_opexp_oprfexpectedr r?s r rnzTestDatetimeArray.check_reducezs / /**W%CS'*FS'*F6*FV,H,,YY\\<<R8<<1  " "68 47'Wf= =r)__name__ __module__ __qualname__r:strboolrErNpytestmark parametrizerWr]rgrSeriesrn __classcell__)r?s@r r5r5[sD /3/4/PPP [[Xe}5U6U.  [[[4*:;6<6> >C>>>rr5c eZdZy) Test2DCompatN)rsrtrur2rr r~r~srr~)__doc__numpyrrxpandas.core.dtypes.dtypesrpandasrpandas._testing_testingrTpandas.core.arraysrpandas.tests.extensionrfixturerrrr(r*r-r3ExtensionTestsr5NDArrayBacked2DTestsr~r2rr rs 5,' ~&8'8   1>++1>h 4,, r