3
®yb[!  ã               @   s    d dl Z d dlZd dlmZ d dlZd dlZd dlmZmZ d dl	j
ZG dd„ dƒZG dd„ deƒZdd	„ Zd
d„ Zdd„ ZG dd„ deƒZG dd„ deƒZdS )é    N)ÚList)ÚapiÚcompatc               @   s   e Zd Zddd„ZdS )ÚBaseNc             C   sJ   t dd„ t|ƒD ƒƒ}|d k	r2t t|ƒt|ƒ ƒ}t |ƒ}tj||ƒ d S )Nc             s   s   | ]}|j d ƒs|V  qdS )Ú__N)Ú
startswith)Ú.0Úf© r
   ú=/tmp/pip-install-4cy230dp/pandas/pandas/tests/api/test_api.pyú	<genexpr>   s    zBase.check.<locals>.<genexpr>)ÚsortedÚdirÚsetÚtmZassert_almost_equal)ÚselfÚ	namespaceÚexpectedÚignoredÚresultr
   r
   r   Úcheck   s
    z
Base.check)N)Ú__name__Ú
__module__Ú__qualname__r   r
   r
   r
   r   r      s   r   c            '   @   s®  e Zd ZU dddgZdddddd	d
ddddddgZddgZee dddgZddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<g'Z	g Z
ee 
d=gZee ejsÎe	jd>d?d@gƒ g Zee dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^gZd_d`dadbdcddgZdedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwgZdxgZdydzd{d|gZg Zee g Zee d}d~dd€d�d‚dƒd„d…d†d‡dˆgZd‰dŠ„ Zd‹dŒ„ Zd�S )ŽÚ	TestPDApiÚtestsÚlocaleZconftestr   Zarraysr   ÚcoreÚerrorsÚpandasZplottingÚtestÚtestingZtseriesÚutilÚoptionsÚioÚnpÚdatetimeZ
IndexSliceZNaTZNAZCategoricalZCategoricalIndexZ	DataFrameZ
DateOffsetZDatetimeIndexZ	ExcelFileZExcelWriterZFloat64IndexZGrouperZHDFStoreÚIndexZ
Int64IndexZ
MultiIndexZPeriodZPeriodIndexZ
RangeIndexZUInt64IndexZSeriesZSparseDtypeZStringDtypeZ	TimedeltaZTimedeltaIndexZ	TimestampZIntervalZIntervalIndexZCategoricalDtypeZPeriodDtypeZIntervalDtypeZDatetimeTZDtypeZBooleanDtypeZ	Int8DtypeZ
Int16DtypeZ
Int32DtypeZ
Int64DtypeZ
UInt8DtypeZUInt16DtypeZUInt32DtypeZUInt64DtypeZNamedAggÚSparseArrayZPanelZSparseSeriesZSparseDataFrameÚarrayZbdate_rangeÚconcatZcrosstabZcutZ
date_rangeZinterval_rangeÚevalZ	factorizeZget_dummiesZ
infer_freqZisnaZisnullZlreshapeZmeltZnotnaZnotnullÚoffsetsÚmergeZmerge_orderedZ
merge_asofZperiod_rangeZpivotZpivot_tableZqcutZshow_versionsZtimedelta_rangeÚuniqueZvalue_countsZwide_to_longZreset_optionZdescribe_optionÚ
get_optionZoption_contextZ
set_optionZset_eng_float_formatZread_clipboardZread_csvZ
read_excelZread_fwfZread_gbqZread_hdfZ	read_htmlÚ	read_jsonZread_pickleZread_sasZread_sqlZread_sql_queryZread_sql_tableZ
read_stataZ
read_tableZread_featherZread_parquetZread_orcZ	read_spssZjson_normalizeZto_datetimeZ
to_numericZ	to_pickleZto_timedeltaÚ_configZ
_hashtableZ_libZ_libsZ_np_version_under1p16Z_np_version_under1p17Z_np_version_under1p18Z_is_numpy_devÚ_testingZ_tslibZ_typingÚ_versionc             C   sz   | j | j | j | j | j | j | j | j | j | j	 }t
jsf|j| j| j | j | j | j ƒ | jt|| jƒ d S )N)ÚlibÚmiscÚmodulesÚclassesÚfuncsÚfuncs_optionÚ
funcs_readÚ
funcs_jsonÚfuncs_toÚprivate_modulesr   ÚPY37ÚextendÚdeprecated_modulesÚdeprecated_classesÚdeprecated_classes_in_futureÚdeprecated_funcs_in_futureÚdeprecated_funcsr   Úpdr   )r   Z
checktheser
   r
   r   Útest_apiÎ   s
    < zTestPDApi.test_apic             C   sš   | j | j | j | j | j }xv|D ]n}tjtƒ�Z tt	|ƒ}t
jsˆ|dkrd|jtt	jjƒd ƒ n$|dkrv|g ƒ n|jt|ƒd ƒ W d Q R X q$W d S )Nr&   é   r(   éÿÿÿÿrH   )r@   rA   rB   rD   rC   r   Úassert_produces_warningÚFutureWarningÚgetattrrE   r   r>   Ú__getattr__r   r&   )r   Zdeprecated_listZdeprÚ
deprecatedr
   r
   r   Ú	test_depræ   s    


zTestPDApi.test_deprN)r   r   r   r   r4   r@   r   Ústrr5   r7   rA   rB   r   r>   r?   r6   r8   r9   r:   r;   r<   rC   rD   r=   rF   rN   r
   r
   r
   r   r      s
  


r   c              C   s|   ddl m }  dd l}|jƒ �V |jdtƒ | dddddƒtj dddddƒksPt‚ttj dddddƒtj ƒsnt‚W d Q R X d S )Nr   )r&   Úignoreiß  rG   é   )r&   ÚwarningsÚcatch_warningsÚsimplefilterrJ   rE   ÚAssertionErrorÚ
isinstance)r&   rR   r
   r
   r   Útest_datetimeú   s    
&rW   c              C   sL   dd l } | jƒ �2 | jdtƒ ttjdddgdd�tjƒs>t‚W d Q R X d S )Nr   rP   rG   rQ   é   ZSparse)Zdtype)	rR   rS   rT   rJ   rV   rE   r)   r(   rU   )rR   r
   r
   r   Útest_sparsearray  s    
rY   c              C   sV   dd l } dd l}| jƒ �4 | jdtƒ tjjddƒ|jddƒkjƒ sHt	‚W d Q R X d S )Nr   rP   é
   )
rR   ZnumpyrS   rT   rJ   rE   r%   ZarangeÚallrU   )rR   r%   r
   r
   r   Útest_np  s
    
r\   c               @   s   e Zd ZdddgZdd„ ZdS )ÚTestApiÚtypesÚ
extensionsZindexersc             C   s   | j t| jƒ d S )N)r   r   Úallowed)r   r
   r
   r   rF     s    zTestApi.test_apiN)r   r   r   r`   rF   r
   r
   r
   r   r]     s   
r]   c               @   s8   e Zd ZddddgZdd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚTestTestingZassert_frame_equalÚassert_series_equalZassert_index_equalZassert_extension_array_equalc             C   s   ddl m} | j|| jƒ d S )Nr   )r!   )r   r!   r   r8   )r   r!   r
   r
   r   Útest_testing&  s    zTestTesting.test_testingc             C   s\   t jjdd ƒ tjtƒ�}dd l}W d Q R X dt|d jƒksBt	‚dt|d jƒksXt	‚d S )Nzpandas.util.testingr   z!pandas.util.testing is deprecatedzpandas.testing instead)
Úsysr6   Úpopr   rI   rJ   Úpandas.util.testingrO   ÚmessagerU   )r   Úmr   r
   r
   r   Útest_util_testing_deprecated+  s
    z(TestTesting.test_util_testing_deprecatedc             C   s`   t jjdd ƒ tjtƒ�}ddlm} W d Q R X dt|d j	ƒksFt
‚dt|d j	ƒks\t
‚d S )Nzpandas.util.testingr   )rb   z!pandas.util.testing is deprecatedzpandas.testing instead)rd   r6   re   r   rI   rJ   rf   rb   rO   rg   rU   )r   rh   rb   r
   r
   r   Ú#test_util_testing_deprecated_direct5  s
    z/TestTesting.test_util_testing_deprecated_directc          	   C   sN   t jtjddgt jd�jƒ }d|ks(t‚tjt	dd�� t
jj W d Q R X d S )Nz-cz6import pandas; pandas.util.testing.assert_series_equal)Ústderrz!pandas.util.testing is deprecatedÚfoo)Úmatch)Ú
subprocessÚcheck_outputrd   Ú
executableÚSTDOUTÚdecoderU   ÚpytestZraisesÚAttributeErrorrE   r"   rl   )r   Úoutr
   r
   r   Útest_util_in_top_level>  s    z"TestTesting.test_util_in_top_levelN)r   r   r   r8   rc   ri   rj   rv   r
   r
   r
   r   ra     s   
	ra   )rn   rd   Útypingr   rs   r   rE   r   r   Zpandas._testingr2   r   r   r   rW   rY   r\   r]   ra   r
   r
   r
   r   Ú<module>   s   
 a
