403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/pandas/tests/extension/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/tests/extension/__pycache__/test_categorical.cpython-312.pyc
�

/	�g����dZddlZddlZddlZddlmZddlZddlm	Z	ddl
mZddl
mZddlmZd�Zej$d��Zej$d	��Zej$d
��Zej$d��Zej$d��Zej$d
��ZGd�dej2�ZGd�dej6�Zy)aj
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)�using_pyarrow_string_dtype��Categorical��CategoricalDtype)�basec��	tjjd�jt	t
j�d��}|d|dk7r	|S�V)N��d)�sizer�)�np�random�default_rng�choice�list�string�
ascii_letters)�valuess �IC:\Python312\Lib\site-packages\pandas/tests/extension/test_categorical.py�	make_datarsT��
����&�&�q�)�0�0��f�6J�6J�1K�RU�0�V���!�9��q�	�!���M��c��t�S�Nr�rr�dtyper)s����rc�(�tt��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 be equal
    )rrrrr�datar.s���y�{�#�#rc�8�ttjdg�S)zLength 2 array with [NA, Valid]�A)rr�nanrrr�data_missingr"8s�������}�%�%rc�&�tgd�gd�d��S)N)r �B�C)r%r r$T��
categories�orderedrrrr�data_for_sortingr)>s����?�D�Q�Qrc�&�tgd�ddgd��S)N)r Nr$r$r Tr&rrrr�data_missing_for_sortingr+Cs���'�S�#�J��M�Mrc��tgd��S)N)�ar-NN�br.r-�crrrr�data_for_groupingr0Hs���A�B�Brc���eZdZejjd���fd��Zd�Zd�Zejjd���fd��Z
ejjd���fd	��Zd
�Zejjddd
g�d��Z�fd�Z�fd�Zdej$f�fd�Zejjd��ejjdddg��fd���Zejjd��ejjdddg��fd���Z�xZS)�TestCategoricalzMemory usage doesn't match��reasonc�$��t�|�|�yr)�super�test_memory_usage��selfr�	__class__s  �rr7z!TestCategorical.test_memory_usageNs���	��!�$�'rc��|jj}||j�}|d|vsJ�|d|vsJ�||vsJ�||vsJ�tjD]}||ur�||vsJ�t�r�||vr�J�y)Nr)r�na_value�isna�tm�NULL_OBJECTSr)r9rr"r<�na_value_objs     r�
test_containszTestCategorical.test_containsSs���
�:�:�&�&���T�Y�Y�[�L�!���A�w�$�����A��,�.�.�.��<�'�'�'��t�#�#�#��O�O�	4�L��x�'���t�+�+�+�-�/�#�|�3�3�3�
	4rc��|j�}|jd|��}t||�sJ�|jt	g�k(sJ�y)N)�)r)�construct_array_type�_empty�
isinstancerr)r9r�cls�results    r�
test_emptyzTestCategorical.test_emptymsL���(�(�*�����D���.���&�#�&�&�&��|�|�/��3�3�3�3rzBackwards compatibilityc�$��t�|�|�yr)r6�test_getitem_scalarr8s  �rrKz#TestCategorical.test_getitem_scalarvs���
	��#�D�)rzUnobserved categories includedc�$��t�|�||�Sr)r6�test_value_counts)r9�all_data�dropnar:s   �rrMz!TestCategorical.test_value_counts}s����w�(��6�:�:rc�2�|d�\}}tj|�}tj|�}|j|d��}tjtt	|�t	|��D��cgc]
\}}||z��c}}�}	tj||	�|jd}
|j|
d��}tjt	|�D�cgc]}||
z��	c}�}	tj||	�ycc}}wcc}w)Nr
c��||zSrr��x1�x2s  r�<lambda>z2TestCategorical.test_combine_add.<locals>.<lambda>�s
��r�B�w�rrc��||zSrrrRs  rrUz2TestCategorical.test_combine_add.<locals>.<lambda>�s
���R��r)�pd�Series�combine�ziprr>�assert_series_equal�iloc)r9�
data_repeated�
orig_data1�
orig_data2�s1�s2rHr-r.�expected�vals           r�test_combine_addz TestCategorical.test_combine_add�s���"/�q�!1��
�J�
�Y�Y�z�
"��
�Y�Y�z�
"�����B� 6�7���9�9�!$�T�*�%5�t�J�7G�!H�I�v��1�Q��U�I�
��	���v�x�0��g�g�a�j�����C�!7�8���9�9�t�J�/?�@�!�a�#�g�@�A��
���v�x�0��
J��As�9D
�$D�	na_actionN�ignorec�X�|jd�|��}tj||�y)Nc��|Srr)�xs rrUz*TestCategorical.test_map.<locals>.<lambda>�s��A�r)re)�mapr>�assert_extension_array_equal)r9rrerHs    r�test_mapzTestCategorical.test_map�s$�����+���;��
�'�'���5rc���|}|dk(r/|jtjjd���t�|�||�y�N�__rmod__z/rmod never called when string is first argumentr3)�applymarker�pytest�mark�xfailr6�test_arith_frame_with_scalar�r9r�all_arithmetic_operators�request�op_namer:s     �rrtz,TestCategorical.test_arith_frame_with_scalar�sI���*���j� �������!�!�L�"��
�
	��,�T�7�;rc���|}|dk(r/|jtjjd���t�|�||�yrn)rprqrrrsr6�test_arith_series_with_scalarrus     �rrzz-TestCategorical.test_arith_series_with_scalar�sI���*���j� �������!�!�L�"��
�
	��-�d�G�<r�serc����d|j�d�}|dvr0d}tjt|��5|||�ddd�yt�|�||||�S#1swYyxYw)N�__)�__eq__�__ne__z7Unordered Categoricals can only compare equality or not)�match)�__name__rq�raises�	TypeErrorr6�_compare_other)r9r{r�op�otherrx�msgr:s       �rr�zTestCategorical._compare_other�sl����r�{�{�m�2�&���.�.�K�C����y��4�
 ��4���
 �
 ��7�)�#�t�R��?�?�
 �
 �s�
A�A!zCategorical overrides __repr__r�big�smallc�&��t�|�||�yr)r6�test_array_repr)r9rrr:s   �rr�zTestCategorical.test_array_repr�s���	����d�+r�TBD�as_indexTFc�&��t�|�||�yr)r6�test_groupby_extension_agg)r9r�r0r:s   �rr�z*TestCategorical.test_groupby_extension_agg�s���	��*�8�5F�Gr)r��
__module__�__qualname__rqrrrsr7rArI�skiprKrMrd�parametrizerlrtrzrWrXr�r�r��
__classcell__)r:s@rr2r2MsW����[�[���:��;�(�<�(�4�44��[�[���6��7�*�8�*��[�[���>��?�;�@�;�1�"�[�[���[�4��*:�;�6�<�6�	<�=�@�"�)�)�@��[�[���>��?��[�[���V�e�W�%5�6�,�7�@�,��[�[���e��$��[�[���Z�$���7�H�8�%�Hrr2c��eZdZd�Zy)�Test2DCompatc���t|jdd��}|jd�dk(sJ�t|jdd��}|jd�dk(sJ�y)Nr
���z
Categories)�repr�reshape�count)r9r�ress   r�test_repr_2dzTest2DCompat.test_repr_2d�s\���4�<�<��2�&�'���y�y��(�A�-�-�-��4�<�<��A�&�'���y�y��(�A�-�-�-rN)r�r�r�r�rrrr�r��s��.rr�)�__doc__r�numpyrrq�pandas._configr�pandasrWr�pandas._testing�_testingr>�pandas.api.typesr�pandas.tests.extensionrr�fixturerrr"r)r+r0�ExtensionTestsr2�NDArrayBacked2DTestsr�rrr�<module>r�s������
�5����-�'�����������$��$����&��&�
���R��R����N��N����C��C�pH�d�)�)�pH�f.�4�,�,�.r

Youez - 2016 - github.com/yon3zu
LinuXploit