HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/pandas/tests/base/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/pandas/tests/base/__pycache__/test_misc.cpython-36.pyc
3

���h3�
@s�ddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlZddlm
Z
mZmZmZddljZejjdd)d*d+d,d-d.d/g�ejjdee
g�dd���Zdd�Zdd�Zejjedd�dd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS)0�N)�PYPY)�is_categorical_dtype�is_datetime64_dtype�is_datetime64tz_dtype�is_object_dtype)�	DataFrame�Index�
IntervalIndex�Serieszop_name, op�add�+�sub�-�mul�*�mod�%�pow�**�truediv�/�floordiv�//�klasscCs^|jj�}d}dj|||g�}|t||�jks2t�dj|||g�}|t|d|�jksZt�dS)N�other� �r)�__name__�lower�join�getattr�__doc__�AssertionError)rZop_name�opZoperand1Zoperand2Zexpected_str�r$�=/tmp/pip-build-5_djhm0z/pandas/pandas/tests/base/test_misc.py�test_binary_ops_docstrings
r&cCs�|}t|jt�rtjd�t|�dkr0tjd�tj|d<|dk}|jdsRt	�|jdsbt	�|dk}|jdsxt	�|jds�t	�d|k}|jds�t	�|jds�t	�d|k}|jds�t	�|jds�t	�t
|j�s�t|j��r2d}tj
t|d��d|kWdQRXtj
t|d��|dkWdQRXnXd|k}|jd�sLt	�|jd�s^t	�|dk}|jd�sxt	�|jd�s�t	�dS)Nz(IntervalIndex doesn't support assignment�z%Test doesn't make sense on empty datarzInvalid comparison)�match)�
isinstance�indexr	�pytest�skip�len�np�nanZiatr"r�dtyper�raises�	TypeError)�series_with_simple_index�series�result�msgr$r$r%�test_none_comparison.s<


r7c
Cs�|}x d
D]}t||d�dk	s
t�q
WxdD]}t||�s,t�q,Wd
}tjt|d��|j�WdQRX|jdksxt�|jt	|�ks�t�t
dg�j�dks�t�tdg�j�dks�t�dS)N�shaper0�T�nbytes�flags�strides�itemsize�base�dataz6can only convert an array of size 1 to a Python scalar)r(r')r8r0r9r:)r;r<r=r>r?)r r"�hasattrr+r1�
ValueError�item�ndim�sizer-rr
)�index_or_series_obj�obj�pr6r$r$r%�test_ndarray_compat_properties^s

rHznot relevant for PyPy)�reasoncCs�|}|j�}|jdd�}t|�p2t|t�o2t|j�}t|j�pRt|t�oRt|jj�}t|�dkr~||kordkns�t�n"|s�|r�||ks�t�n||ks�t�|t	j
|�}t|�dks�t�dS)NT)�deepr�d)�memory_usagerr)r
r*rr0r-r"�sys�	getsizeof�abs)rErF�resZres_deepZ	is_objectZis_categoricalZdiffr$r$r%�test_memory_usagets
rQcCs:|}|jdd�}|jdd�}|jj�}|||ks6t�dS)NT)r*F)rLr*r")r3r4�total_usage�non_index_usage�index_usager$r$r%�#test_memory_usage_components_series�s

rUcCs:|}|jdd�}|jdd�}|jj�}|||ks6t�dS)NT)r*F)rLr*r")Z
narrow_seriesr4rRrSrTr$r$r%�*test_memory_usage_components_narrow_series�s

rVcCs�|}t|tj�rtjd�t|dd�}tj||�}d|koHt|�knsRt	�tj||t
t|��d�}d|ko�t|�kns�t	�dS)Nz-np.searchsorted doesn't work on pd.MultiIndexr)�default)Zsorter)r)�pd�
MultiIndexr+r,�maxr.Zsearchsortedr-r"�range)rErFZmax_objr*r$r$r%�test_searchsorted�s
 r\cCs�t|�dkrtjd�nt|tj�r.tjd�tj|�}|d|jdksNt�|d|jdksdt�|d
|jdkszt�t|�}|d||dks�t�d|�d|��}tj	t
|d��||WdQRXd	}tj	t
|d��|j|WdQRXdS)
Nrz%Test doesn't make sense on empty dataz(Can't instantiate Series from MultiIndex�r'zindex z' is out of bounds for axis 0 with size )r(z*single positional indexer is out-of-bounds���r^r^)r-r+r,r)rXrYr
Zilocr"r1�
IndexError)r*r4rDr6r$r$r%�test_access_by_position�s 

r`cCsXtjddg�jtjdg��\}}tjtjdgtjd�|�tjtjdgtjd�|�dS)N�A�Brr')r0r^)	rXrZget_indexer_non_unique�tmZassert_numpy_array_equalr.�arrayZintpZint64)�indexes�missingr$r$r%�*test_get_indexer_non_unique_dtype_mismatch�s rg)rr)r
r)rr)rr)rr)rr)rr) rMZnumpyr.r+Z
pandas.compatrZpandas.core.dtypes.commonrrrrZpandasrXrrr	r
Zpandas._testingZ_testingrc�markZparametrizer&r7rHZskipifrQrUrVr\r`rgr$r$r$r%�<module>s2
0