U
    sVc                      @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	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 )    )annotationsN)apic                   @  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|| d S )Nc                 s  s$   | ]}| d s|dkr|V  qdS )__r   N)
startswith).0f r	   =/tmp/pip-unpacked-wheel-xj8nt62q/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g	ZddddgZddgZded< 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/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBg+Z	d d%d*gZ
dedC< dDgZdedE< g ZdedF< dGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddegZdfdgdhdidjdkgZdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dgZdgZddddgZg Zded< g Zded< ddddddgZdd Zdd Zdd ZdS )	TestPDApitestslocaleZconftestr   ZarraysoptionstesttestingerrorsZplottingioZtseriescompatcorepandasutilnpdatetimez	list[str]deprecated_modulesZ
IndexSliceZNaTZNAZ
ArrowDtypeZCategoricalZCategoricalIndexZ	DataFrameZ
DateOffsetZDatetimeIndexZ	ExcelFileZExcelWriterZFloat64IndexZFlagsZGrouperZHDFStoreZ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Float32DtypeZFloat64DtypeZNamedAggdeprecated_classesSparseArraydeprecated_classes_in_futuremodulesarrayZbdate_rangeconcatZcrosstabZcutZ
date_rangeZinterval_rangeevalZ	factorizeZget_dummiesZfrom_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_htmlZread_xml	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deprecated_funcs_in_futuredeprecated_funcs_configZ_libsZ_is_numpy_dev_testing_typing_versionc                 C  sX   | j | j | j | j | j | j | j | j | j | j	 | j
 }| jt|| jd d S )N)r   r   r   )
public_libprivate_libmiscr+   classesfuncsfuncs_option
funcs_read
funcs_jsonfuncs_toprivate_modulesr   pdr   )r   Z
checktheser	   r	   r
   test_api   s.    	
zTestPDApi.test_apic                 C  sr   t | j| j | j | j | j | j | j | j | j	 t | j
 }t tj}|| }|r^t|| }|rntd S N)r   r:   r<   r+   r=   r>   r?   r@   rA   rB   r(   rD   __all__AssertionError)r   r   actualZ
extraneousmissingr	   r	   r
   test_api_all   s4    

zTestPDApi.test_api_allc              
   C  sL   | j | j | j | j | j }|D ]$}tt tt	|}W 5 Q R X q"d S rF   )
r'   r(   r*   r5   r4   r   assert_produces_warningFutureWarninggetattrrD   )r   Zdeprecated_listZdepr_r	   r	   r
   	test_depr   s    zTestPDApi.test_deprN)r   r   r   r   r:   r;   r'   __annotations__r<   r=   r(   r*   r+   r>   r?   r@   rA   rB   r4   r5   rC   rE   rK   rP   r	   r	   r	   r
   r      s  


/$	r   c               	   C  sv   ddl m }  dd l}| P |dt | ddddd| dddddksNtt| ddddd| shtW 5 Q R X d S )Nr   )r&   ignorei        )r&   warningscatch_warningssimplefilterrM   rH   
isinstance)r&   rU   r	   r	   r
   test_datetime   s    
$rY   c               	   C  sL   dd l } |  2 | dt ttjdddgddtjs>tW 5 Q R X d S )Nr   rR   rS   rT      ZSparse)Zdtype)	rU   rV   rW   rM   rX   rD   r,   r)   rH   )rU   r	   r	   r
   test_sparsearray  s    
r[   c               	   C  sV   dd l } dd l}|  4 | dt tjdd|ddk sHt	W 5 Q R X d S )Nr   rR   
   )
rU   ZnumpyrV   rW   rM   rD   r%   ZarangeallrH   )rU   r%   r	   r	   r
   test_np  s
    
r^   c                   @  s    e Zd ZddddgZdd ZdS )TestApitypes
extensionsZindexersZinterchangec                 C  s   |  t| j d S rF   )r   r   allowed)r   r	   r	   r
   rE     s    zTestApi.test_apiN)r   r   r   rb   rE   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 d S )Nr   )r   )r#   r   r   r>   )r   r   r	   r	   r
   test_testing'  s    zTestTesting.test_testingc              	   C  s\   t jdd  tt}dd l}W 5 Q R X dt|d jksBt	dt|d jksXt	d S )Npandas.util.testingr   !pandas.util.testing is deprecatedpandas.testing instead)
sysr+   popr   rL   rM   pandas.util.testingstrmessagerH   )r   mr#   r	   r	   r
   test_util_testing_deprecated,  s
    z(TestTesting.test_util_testing_deprecatedc              	   C  s`   t jdd  tt}ddlm} W 5 Q R X dt|d j	ksFt
dt|d j	ks\t
d S )Nrf   r   )rd   rg   rh   )ri   r+   rj   r   rL   rM   rk   rd   rl   rm   rH   )r   rn   rd   r	   r	   r
   #test_util_testing_deprecated_direct6  s
    z/TestTesting.test_util_testing_deprecated_directc              	   C  sN   t jtjddgt jd }d|ks(ttjt	dd t
jj W 5 Q R X d S )Nz-cz6import pandas; pandas.util.testing.assert_series_equal)stderrrg   foo)match)
subprocesscheck_outputri   
executableSTDOUTdecoderH   pytestZraisesAttributeErrorrD   r$   rr   )r   outr	   r	   r
   test_util_in_top_level?  s    
z"TestTesting.test_util_in_top_levelN)r   r   r   r>   re   ro   rp   r|   r	   r	   r	   r
   rc     s   
	rc   )
__future__r   rt   ri   ry   r#   rD   r   Zpandas._testingr7   r   r   r   rY   r[   r^   r_   rc   r	   r	   r	   r
   <module>   s    _
