Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/tests/extension/__pycache__/test_categorical.cpython-37.pyc
Назад
B �5�gf% � @ s� d Z ddlZddlZddlZddlZddlmZmZm Z ddl mZ ddl mZ ddlmZ dd� Zejdd � �Zejd d� �Zejdd � �Zejdd� �Zejdd� �Zejdd� �Zejdd� �ZG dd� dej�ZG dd� dej�ZG dd� dej�ZG dd� dej �Z!G dd� dej"�Z#G d d!� d!ej$�Z%G d"d#� d#ej&�Z'G d$d%� d%ej(�Z)G d&d'� d'ej*�Z+G d(d)� d)ej,�Z-G d*d+� d+ej.�Z/G d,d-� d-ej0�Z1G d.d/� d/ej2�Z3dS )0aj This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal tweaks should be applied to get the tests passing (by overwriting a parent method). Additional tests should either be added to one of the BaseExtensionTests classes (if they are relevant for the extension interface for all dtypes), or be added to the array-specific tests in `pandas/tests/arrays/`. � N)�Categorical�CategoricalIndex� Timestamp)�CategoricalDtype)�basec C s2 x,t jjttj�dd�} | d | d krP qW | S )N�d )�sizer � )�np�random�choice�list�string� ascii_letters)�values� r �]/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/tests/extension/test_categorical.py� make_data s r c C s t � S )N)r r r r r �dtype+ s r c C s t t� �S )z�Length-100 array for this type. * data[0] and data[1] should both be non missing * data[0] and data[1] should not gbe equal )r r r r r r �data0 s r c C s t tjdg�S )zLength 2 array with [NA, Valid]�A)r r �nanr r r r �data_missing: s r c C s t dddgdddgdd�S )Nr �B�CT)� categories�ordered)r r r r r �data_for_sorting@ s r c C s t dd dgddgdd�S )Nr r T)r r )r r r r r �data_missing_for_sortingE s r c C s t jS )N)r r r r r r �na_valueJ s r c C s t ddd d ddddg�S )N�a�b�c)r r r r r �data_for_groupingO s r# c @ s e Zd ZdS )� TestDtypeN)�__name__� __module__�__qualname__r r r r r$ T s r$ c s2 e Zd Zejjdd�� fdd��Zdd� Z� ZS )� TestInterfacezMemory usage doesn't match)�reasonc s t � �|� d S )N)�super�test_memory_usage)�selfr )� __class__r r r+ Y s zTestInterface.test_memory_usagec C s� |j j}||�� }|d |ks&t�|d |ks6t�||ksBt�||ksNt�x0tjD ]&}||krdqV||kspt�||ksVt�qVW d S )Nr )r r Zisna�AssertionError�tmZNULL_OBJECTS)r, r r r Zna_value_objr r r � test_contains^ s zTestInterface.test_contains) r% r&