gL i dZddlmZddlmZddlZddlZddlm Z m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZerddlZej4d d g dZej4dZej4dZej4dZej4dZej4dZ GddejBZ"GddejFZ$y)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/`. ) annotations) TYPE_CHECKINGN)PeriodiNaT)is_platform_windows)np_version_gte1p24) PeriodDtype PeriodArray)baseD2D)paramsc.t|jS)Nfreq)r param)requests h/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/tests/extension/test_period.pydtyper(s GMM **cDttjdd|S)Niir)r nparangers rdatar-s ryyt,E ::rc tgd|S)N)rr rs rdata_for_sortingr!2s ) 77rc(ttdg|S)Nr rr rrs r data_missingr$7s d|5 11rc*tdtdg|S)Nrr rr#rs rdata_missing_for_sortingr&<s dD) 77rc Dd}t}d}d}t||||||||g|S)Nrr rr)rr )rBNAACs rdata_for_groupingr,As4 A B A A 1b"aAq1 ??rceZdZfdZd dZd dZdfd ZejjdddgfdZ ejjd d d gd Z xZ S)TestPeriodArrayc0|dvryt||||S)N)__sub____rsub__)super_get_expected_exception)selfop_nameobjother __class__s rr3z'TestPeriodArray._get_expected_exceptionKs# - -w.wUCCrc |dvS)N)cummincummax)r4serr5s r_supports_accumulationz&TestPeriodArray._supports_accumulationPs...rc |dvS)N)minmaxmedianr<)r4r6r5s r_supports_reductionz#TestPeriodArray._supports_reductionSs222rc@|dk(rt||}|jd}t||}||}||}|jj} t j t || }tj||yt |)|||S)NrBint64)skipnar) getattrastyperrr _from_ordinalinttmassert_almost_equalr2 check_reduce) r4r=r5rFres_opaltexp_opresultexpectedrr8s rrMzTestPeriodArray.check_reduceVs h S'*F**W%CS'*F6*FV,H99>>D++CMEH  " "68 47'Wf= =rperiodsctr;tr5tjtd5t |||dddyt |||y#1swYyxYw)NF)check_stacklevel)rrrKassert_produces_warningRuntimeWarningr2 test_diff)r4rrSr8s rrZzTestPeriodArray.test_diffhsV  %7++NUS 1!$0 1 1 G dG , 1 1s AA! na_actionNignorecX|jd|}tj||y)Nc|S)Nr<)xs rz*TestPeriodArray.test_map..rsAr)r[)maprKassert_extension_array_equal)r4rr[rQs rtest_mapzTestPeriodArray.test_mapps$+; ''5r)r5strreturnbool)r=z pd.Seriesr5rdrFrf) __name__ __module__ __qualname__r3r>rCrMpytestmark parametrizerZrc __classcell__)r8s@rr.r.JskD /3>$ [[YB0-1- [[[4*:;6<6rr.c eZdZy) Test2DCompatN)rgrhrir<rrrorovsrro)%__doc__ __future__rtypingrnumpyrrj pandas._libsrr pandas.compatrpandas.compat.numpyrpandas.core.dtypes.dtypesr pandas._testing_testingrKpandas.core.arraysr pandas.tests.extensionr pandaspdfixturerrr!r$r&r,ExtensionTestsr.NDArrayBacked2DTestsror<rrrs#  .21*'T{#+$+;;882288@@)6d)))6X 4,, r