Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/tests/io/parser/__pycache__/test_unsupported.cpython-37.pyc
Назад
B �5�g� � @ s� d Z ddlmZ ddlZddlmZ ddlmZ ddl m Z ddlm m m Z ejddgdd � d �dd� �ZG d d� d�ZdS )a Tests that features that are currently unsupported in either the Python or C parser are actually enforced and are clearly communicated to the user. Ultimately, the goal is to remove test cases from this test suite as new feature support is added to the parsers. � )�StringION)�ParserError)�read_csv�pythonz python-fwfc C s | S )N� )�valr r �]/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/tests/io/parser/test_unsupported.py�<lambda> � r )�paramsZidsc C s | j S )N)�param)�requestr r r � python_engine s r c @ s, e Zd Zdd� Zdd� Zdd� Zdd� Zd S ) �TestUnsupportedFeaturesc C sF d}d}x8dD ]0}t jt|d�� tt|�|dd� W d Q R X qW d S )Nza b c 1 2 3zis not supported)�cr )�matchF)�engineZmangle_dupe_cols)�pytest�raises� ValueErrorr r )�self�data�msgr r r r �test_mangle_dupe_cols_false s z3TestUnsupportedFeatures.test_mangle_dupe_cols_falsec C sX d}d}t jt|d�� tt|�dd dd� W d Q R X t jt|d�� tt|�ddd� W d Q R X t jt|d�� tt|�dd td �d� W d Q R X t jt|d�� tt|�ddd � W d Q R X t�tj �� tt|�d dd� W d Q R X t�tj �� tt|�dd� W d Q R X t�tj �� tt|�d td �d� W d Q R X t�tj �� tt|�dd� W d Q R X d}d}t jt |d�� tt|�dd� W d Q R X t jt |d�� tt|�ddd� W d Q R X d}d}t jt|d�� tt|�dd� W d Q R X t jt|d�� tt|�dd� W d Q R X d}d}t jt|d�� tt|�dd� W d Q R X d S )Nza b c 1 2 3zdoes not support)r r F)r �sep�delim_whitespacez\s)r r � � )r r � quotechar� )r � skipfooter)r r )r )r r )r a A B C D E one two three four a b 10.0032 5 -0.5109 -2.3358 -0.4645 0.05076 0.3640 a q 20 4 0.4473 1.4152 0.2834 1.00661 0.1744 x q 30 3 -0.6662 -0.5243 -0.3580 0.89145 2.5838zError tokenizing dataz\s+z)Only length-1 thousands markers supportedzA|B|C 1|2,334|5 10|13|10. z,,)Z thousands� z(Only length-1 line terminators supportedza,b,c~~1,2,3~~4,5,6z~~)�lineterminator)r r r r r �chr�tmZassert_produces_warning�parsersZ ParserWarningr )r r r �textr r r � test_c_engine$ sD " z%TestUnsupportedFeatures.test_c_enginec C sx ddl m} d}xb|D ]Z}dt|�� dt|�� d�}|t� i}tjt|d�� tt|�fd|i|�� W d Q R X qW d S ) Nr )�_python_unsupportedz*1,2,3,, 1,2,3,4, 1,2,3,4,5 1,2,,, 1,2,3,4,zThe z" option is not supported with the z engine)r r ) �pandas.io.parsers.readersr( �repr�objectr r r r r )r r Zpy_unsupportedr �defaultr �kwargsr r r �test_python_engineX s z*TestUnsupportedFeatures.test_python_enginec C sD G dd� d�}d}d}t jt|d�� t||�|d� W d Q R X d S )Nc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )zMTestUnsupportedFeatures.test_python_engine_file_no_next.<locals>.NoNextBufferc S s || _ d S )N)r )r Zcsv_datar r r �__init__n s zVTestUnsupportedFeatures.test_python_engine_file_no_next.<locals>.NoNextBuffer.__init__c S s | S )Nr )r r r r �__iter__q s zVTestUnsupportedFeatures.test_python_engine_file_no_next.<locals>.NoNextBuffer.__iter__c S s | j S )N)r )r r r r �readt s zRTestUnsupportedFeatures.test_python_engine_file_no_next.<locals>.NoNextBuffer.readN)�__name__� __module__�__qualname__r/ r0 r1 r r r r �NoNextBufferm s r5 za 1z"The 'python' engine cannot iterate)r )r )r r r r )r r r5 r r r r r �test_python_engine_file_no_nextk s z7TestUnsupportedFeatures.test_python_engine_file_no_nextN)r2 r3 r4 r r'