Your IP : 216.73.216.213
��Yf�- � @ s= d Z d d l m Z d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l
Z
d d l m Z m
Z
m Z m Z d d l m Z e d � Z e j o� d e j k Z e
j e e d � d
� Gd d � d e
j � � Z Gd
d � d e
j � Z d d d d � Z e d k r9e
j � d S)z:
Very minimal unittests for parts of the readline module.
� )� ExitStack)�EION)�
import_module�unlink�temp_dir�TESTFN)�assert_python_ok�readline�libedit�
clear_historyzXThe history update test cannot be run because the clear_history method is not available.c @ sU e Z d Z d Z d d � Z e j e e d � d � d d � � Z d d � Z
d
S)�TestHistoryManipulationz�
These tests were added to check that the libedit emulation on OSX and the
"real" readline have the same interface for history manipulation. That's
why the tests cover only a small subset of the interface.
c C s9 t j � t j d � t j d � | j t j d � d � | j t j d � d � | j t j d � d � t j d d � | j t j d � d � | j t j d � d � | j t j d � d � | j t j � d � t j d � | j t j d � d � | j t j d � d � | j t j � d � d S)Nz
first linezsecond liner � � z
replaced line)r r �add_history�assertEqual�get_history_item�replace_history_item�get_current_history_lengthZremove_history_item)�self� r �7/opt/alt/python35/lib64/python3.5/test/test_readline.py�testHistoryUpdates s
z*TestHistoryManipulation.testHistoryUpdates�append_history_filezappend_history not availablec
C s� t j d d � } | j � | j } | j t | � t j � t j d � t j d � t j | � t j � | j
t j � d � t j | � | j
t j � d � | j
t j
d � d � | j
t j
d � d � t j d | � t j � t j | � | j
t j � d � | j
t j
d � d � | j
t j
d � d � | j
t j
d � d � t j | � | j t � � t j d | � Wd QRXt j | � d S) NZdeleteFz
first linezsecond liner r r
� )�tempfileZNamedTemporaryFile�close�name�
addCleanupr r r r �write_history_filer r �read_history_filer r �osZassertRaises�FileNotFoundError)r ZhfileZ hfilenamer r r �test_write_read_append5 s2
z.TestHistoryManipulation.test_write_read_appendc C s� t j � y t j d � Wn<