Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/tests/indexes/__pycache__/test_common.cpython-37.pyc
Назад
B �5�g8 � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddl m Z mZ ddlZ ddlmZmZmZmZmZmZ ddlmZ G dd� d�Zej�d dd g�dd� �Zej�d d dg�dd� �Zdd� ZdS )z� Collection of tests asserting things that should be true for any index subclass. Makes use of the `indices` fixture defined in pandas/tests/indexes/conftest.py. � N)�iNaT)�IS64)�is_period_dtype�needs_i8_conversion)�CategoricalIndex� DatetimeIndex� MultiIndex�PeriodIndex� RangeIndex�TimedeltaIndexc @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zej�dddddd d!g�d"d#� �Zd$d%� Zd&S )'� TestCommonc C s� t |t�rd S |�g ��|�s"t�xV|j|jgfD ]D}t |jt�rN||jkrNq2d}tjt |d�� |�|� W d Q R X q2W x6ddgfD ](}tjt dd�� |�|� W d Q R X q�W d S )NzTCannot remove 1 levels from an index with 1 levels: at least one level must be left.)�match�wrongz>'Requested level \(wrong\) does not match index name \(None\)')� isinstancer Z droplevel�equals�AssertionError�name�tuple�pytest�raises� ValueError�KeyError)�self�index�level�msg� r �V/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/tests/indexes/test_common.py�test_droplevel s zTestCommon.test_droplevelc C s` |}d}dgg}t jt|d�� |j|d� W d Q R X t jt|d�� |j|d� W d Q R X d S )Nz"Index.name must be a hashable type�1)r )r )�names)r r � TypeError�rename� set_names)r � index_flatr �messageZrenamedr r r �"test_constructor_non_hashable_name: s z-TestCommon.test_constructor_non_hashable_namec C s$ |}t |�|�}t�|j|j� d S )N)�type�tmZassert_equal�_data)r r$ �a�br r r �test_constructor_unwraps_indexI s z)TestCommon.test_constructor_unwraps_indexc C s |}|� � }t�||� d S )N)Z to_flat_indexr( �assert_index_equal)r r$ r �resultr r r �test_to_flat_indexN s zTestCommon.test_to_flat_indexc C s� |}d}|j }|�|g�}|j |ks(t�|j |ks6t�|j|dd�}|d ksPt�|j |ks^t�|j|gksnt�tjtdd�� |jddd� W d Q R X d }|j|dd� |j |ks�t�|j|gks�t�d S ) Nz#This is the new name for this indexT)�inplacezLevel must be None)r r* r )r )�A�B)r r# r r"