3
���h�4 � @ s d Z ddlmZ ddlZddlZddlmZ ddlZddlm Z ddl
jjZ
ddlZddljZddljjZG dd� d�ZeeegZyddlmZ eje� W n ek
r� Y nX ejjejj e!��Z"ej#j$d �G d
d� d��Z%ej&dd
� �Z'G dd� d�Z(dd� Z)dS )z0
Tests for the pandas.io.common functionalities
� )�StringION)�Path)�is_platform_windowsc @ s e Zd ZdZdd� Zdd� ZdS )�CustomFSPathz%For testing fspath on unknown objectsc C s
|| _ d S )N)�path)�selfr � r �=/tmp/pip-build-5_djhm0z/pandas/pandas/tests/io/test_common.py�__init__ s zCustomFSPath.__init__c C s | j S )N)r )r r r r �
__fspath__ s zCustomFSPath.__fspath__N)�__name__�
__module__�__qualname__�__doc__r
r r r r r r s r )�localz*ignore:can't resolve package:ImportWarningc @ s� e Zd ZdZdd� Zdd� Zdd� Zejd�d d
� �Z dd� Z
ejj
d
d\d]d^d_d`dadbdcddg �ejj
de�dd� ��Zdd � Zd!d"� Zd#d$� Zejj
d%ejd&ed'fejd&ed(fejd)ed*fejd+ed,fejd-ed.fejd&ed/fejd&ed0fejd&ed1fejd&ed2fg �d3d4� �Z ejj
d%ejd&ed'fej!d&ed'fejd&ed(fejd)ed*fejd+ed,fejd-ed.fejd&ed/fejd&ed0fejd&ed1fejd&ed2fg
�d5d6� �Z"ejj
d7ejd&defej!d&dffejd&dgfejd)dhfejd+difejd-djfejd&dkfejd&dlfejd&dmfejd&dnfg
�ejj#dH�dIdJ� ��Z$ejj
dKdLi d&fdMdNdOidOfdPi d+fdQi d&fdRi d&fdSi d&fdTi d&fdUdVej%dW�id&fg�dXdY� �Z&dZd[� Z'dS )o�TestCommonIOCapabilitiesziindex,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
qux,12,13,14,15
foo2,12,13,14,15
bar2,12,13,14,15
c C sB d}t j|�}||kst�tjj|�s*t�tjj|�|ks>t�d S )Nz
~/sometest)�icom�_expand_user�AssertionError�osr �isabs�
expanduser)r �filename�
expanded_namer r r �test_expand_user7 s
z)TestCommonIOCapabilities.test_expand_userc C s2 d}t j|�}||kst�tjj|�|ks.t�d S )Nz/somefolder/sometest)r r r r r r )r r r r r r �test_expand_user_normal_path? s
z5TestCommonIOCapabilities.test_expand_user_normal_pathc C sB t jtd��}|dkst�t jtd��}|tjjdd�ks>t�d S )N�.zfoo//bar�foo�bar)r �stringify_pathr r r r �join)r �rel_pathZredundant_pathr r r �test_stringify_path_pathlibF s z4TestCommonIOCapabilities.test_stringify_path_pathlibzpy.pathc C s8 t jjdd�}t jj|�}t|�}tj|�|ks4t�d S )Nr r )r r r �abspath� LocalPathr r r )r r �abs_pathZlpathr r r �test_stringify_path_localpathL s z6TestCommonIOCapabilities.test_stringify_path_localpathc C s" |