Your IP : 18.226.187.60
�
e f� � @ s� d d l Z d d l Z d d l m Z m Z Gd d � d e � Z Gd d � d � Z Gd d � d e j � Z Gd d
� d
e j � Z
e d k r� e j � n d S)� N)�PseudoInputFile�PseudoOutputFilec @ sX e Z d Z d d � Z d d � Z d d � Z d d � Z d d
� Z d d � Z d
S)�Sc C s d t | � j S)Nz%s:str)�type�__name__)�self� r �>/opt/alt/python34/lib64/python3.4/idlelib/idle_test/test_io.py�__str__ s z S.__str__c C s d t | � j S)Nz
%s:unicode)r r )r r r r �__unicode__ s z
S.__unicode__c C s d S)N� r )r r r r �__len__ s z S.__len__c C s
t d � S)N�abc)�iter)r r r r �__iter__
s z
S.__iter__c G s d t | � j S)Nz%s:item)r r )r �argsr r r �__getitem__ s z
S.__getitem__c G s d t | � j S)Nz%s:slice)r r )r r r r r �__getslice__ s zS.__getslice__N) r �
__module__�__qualname__r
r r
r r r r r r r r s r c @ sX e Z d Z d d � Z d d � Z d d � Z d d � Z d d
� Z d d � Z d
S)� MockShellc C s | j � d S)N)�reset)r r r r �__init__ s zMockShell.__init__c G s | j j | � d S)N)�written�append)r r r r r �write s zMockShell.writec C s
| j j � S)N)�lines�pop)r r r r �readline s zMockShell.readlinec C s d S)Nr )r r r r �close s zMockShell.closec C s
g | _ d S)N)r )r r r r r ! s zMockShell.resetc C s t | � d d d � | _ d S)N� ���)�listr )r r r r r �push$ s zMockShell.pushN) r r r r r r r r r# r r r r r s r c @ sL e Z d Z d d � Z d d � Z d d � Z d d � Z d d
� Z d S)�PseudeOutputFilesTestc C s� t � } t | d d � } | j | t j � | j | j d � | j | j � | j | j � | j | j
d � | j | j � | j
| j � � | j | j � � | j
| j � � | j | j � � d S)N�stdoutzutf-8z<stdout>)r r �assertIsInstance�io�
TextIOBase�assertEqual�encoding�assertIsNone�errors�newlines�name�assertFalse�closed�
assertTrue�isatty�readable�writable�seekable)r �shell�fr r r � test_misc) s zPseudeOutputFilesTest.test_miscc C s� t � } t | d d � } | j t | j � | j t | j � | j t | j d � | j t | j d � | j t | j d � d S)Nr% zutf-8r ) r r �assertRaises�OSError�fileno�tell�seek�readr )r r6 r7 r r r �test_unsupported7 s z&PseudeOutputFilesTest.test_unsupportedc C s^ t � } t | d d � } | j d � | j | j d g � | j � | j d � | j | j d
g � | j � | j t d � � | j | j d g � | j t | j d d � t � | j � | j t
| j � | j | j g � | j t
| j d � | j t
| j d � | j | j g � | j t
| j d d � | j | j g � d S)Nr% zutf-8�test� tèstr s test�{ Zspam)r@ �stdout)rA rC )rA rC )r r r r) r r r r �strr9 � TypeError)r r6 r7 r r r �
test_write@ s&