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
U
­ý°d§ã@sØddlmZddlZddlZddlZddlmZddlZddlm    Z    m
Z
m Z ddl m ZddlmZddlmZmZdd„Zd    d
„Zeje eee
gd d d dgddd„ƒZGdd„dƒZGdd„dƒZGdd„dƒZdS)é)ÚdatetimeN)ÚPYPY)Ú    DataFrameÚIndexÚSeries)ÚPandasDelegate)ÚNoNewAttributesMixinÚ PandasObjectcKstd|if|ŽdS)NÚa©r©ÚxÚkwargs©rúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/base/test_constructors.pyÚseries_via_frame_from_dictsrcKst|f|ŽdS)Nrr r rrrÚseries_via_frame_from_scalarsrrzDataFrame-dictzDataFrame-arrayr)ÚparamsÚidscCs|jS©N)Úparam)ÚrequestrrrÚ constructors
rc@sLeZdZGdd„dƒZGdd„deeƒZdd„Zej    j
e ddd    d
„ƒZ d S) ÚTestPandasDelegatec@s>eZdZdgZdgZdd„Zdd„ZeeeddZd    d
„Z    d S) zTestPandasDelegate.DelegatorÚpropÚ test_methodcCs
||_dSr©r)ÚselfÚvaluerrrÚ    _set_prop1sz&TestPandasDelegate.Delegator._set_propcCs|jSrr)rrrrÚ    _get_prop4sz&TestPandasDelegate.Delegator._get_propz foo property)ÚdoccOsdS)z a test methodNr)rÚargsrrrrr9sz(TestPandasDelegate.Delegator.test_methodN)
Ú__name__Ú
__module__Ú __qualname__Ú _propertiesÚ_methodsrr ÚpropertyrrrrrrÚ    Delegator-s r)c@seZdZddœdd„ZdS)zTestPandasDelegate.DelegateN)ÚreturncCs
||_dSr)Úobj)rr+rrrÚ__init__=sz$TestPandasDelegate.Delegate.__init__)r#r$r%r,rrrrÚDelegate<sr-c    Cs®|jj|j|jjdd|jj|j|jjdd| | ¡¡}d}tjt|d |jW5QRXd}tjt|d d|_W5QRXd}tjt|d |jW5QRXdS)Nr()ÚdelegateZ    accessorsÚtypÚmethodz#You cannot access the property prop©ÚmatchzThe property prop cannot be seté)    r-Z_add_delegate_accessorsr)r&r'ÚpytestÚraisesÚ    TypeErrorr)rr.ÚmsgrrrÚtest_invalid_delegation@s(ýÿz*TestPandasDelegate.test_invalid_delegationznot relevant for PyPy)ÚreasoncCs| | ¡¡}t |¡dSr)r-r)ÚsysÚ    getsizeof)rr.rrrÚtest_memory_usage\sz$TestPandasDelegate.test_memory_usageN) r#r$r%r)rr    r-r8r4ÚmarkZskipifrr<rrrrr,s
rc@seZdZdd„ZdS)ÚTestNoNewAttributesMixinc    Cs”Gdd„dtƒ}|ƒ}t|dƒr$t‚d|_|jdks8t‚| ¡dt|ƒksPt‚t|dƒs^t‚d}tjt    |d d|_
W5QRXt|dƒrt‚dS)Nc@s eZdZdS)z.TestNoNewAttributesMixin.test_mixin.<locals>.TN)r#r$r%rrrrÚTgsr?Z__frozenÚtestz You cannot add any new attributer1Úb) rÚhasattrÚAssertionErrorr
Z_freezeÚdirÚgetattrr4r5ÚAttributeErrorrA)rr?Útr7rrrÚ
test_mixinfsz#TestNoNewAttributesMixin.test_mixinN)r#r$r%rHrrrrr>esr>c    @s~eZdZejjdejdgddejedddƒge    deje 
dd¡ge    dejdge    dgddd    d
gd d d „ƒZ dd„Z dS)ÚTestConstructionr
z
2263-01-01z datetime64[D]©Údtypei×éÚDzobject-datetime.datetimezobject-numpy-scalarz object-string)rc    Cs||jjdkr$||ƒ}|jdksJt‚n&||ƒ}|jdks:t‚t | ¡|¡d}tjtj    j
|d||ddW5QRXdS)NÚMzM8[s]Úobjectz4Out of bounds|Out of bounds .* present at position 0r1zdatetime64[ns]rJ) rKÚkindrCÚtmZassert_numpy_array_equalZto_numpyr4r5ÚpdÚerrorsZOutOfBoundsDatetime)rr
rÚresultr7rrrÚ$test_constructor_datetime_outofbound~s z5TestConstruction.test_constructor_datetime_outofboundcCsrtjdgdd}tjjjj||jd}||ƒ}|j|jks>t‚||ƒ}t     
||¡d|j _ ||ƒ}t     
||¡dS)Nz2020-01-01T00:00:00.000000zdatetime64[us]rJF) ÚnpÚarrayrRÚcoreZarraysZ DatetimeArrayZ _simple_newrKrCrQZ assert_equalÚflagsZ    writeable)rrZarrZdtaÚexpectedrTrrrÚtest_constructor_datetime_nonns¢s z0TestConstruction.test_constructor_datetime_nonnsN) r#r$r%r4r=Z parametrizerVrWrrOZ
datetime64rUr[rrrrrIzsüüø
rI)rr:ÚnumpyrVr4Z pandas.compatrZpandasrRrrrZpandas._testingZ_testingrQZpandas.core.accessorrZpandas.core.baserr    rrZfixturerrr>rIrrrrÚ<module>s.    ü
ù    
9