ó
­ŦY]c           @   sĨ   d  Z  d d l Z d d l Z d d l m Z m Z d d l m Z e d  Z d e j	 f d     YZ
 d e j	 f d	     YZ d
   Z e d k rĄ e   n  d S(   s:   
Very minimal unittests for parts of the readline module.
iĸĸĸĸN(   t   run_unittestt   import_module(   t   assert_python_okt   readlinet   TestHistoryManipulationc           B   s2   e  Z d  Z e j e e d  d  d    Z RS(   sŲ   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.
    t   clear_historysX   The history update test cannot be run because the clear_history method is not available.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(   Ns
   first lines   second linei    i   i   s   replaced line(	   R   R   t   add_historyt   assertEqualt   get_history_itemt   Nonet   replace_history_itemt   get_current_history_lengtht   remove_history_item(   t   self(    (    s#   lib/python2.7/test/test_readline.pyt   testHistoryUpdates   s    
(   t   __name__t
   __module__t   __doc__t   unittestt
   skipUnlesst   hasattrR   R   (    (    (    s#   lib/python2.7/test/test_readline.pyR      s   t   TestReadlinec           B   s;   e  Z e j e j d  k  o' d e j k d  d    Z RS(   i  t   libedits%   not supported in this library versionc         C   s2   t  d d d d \ } } } |  j | d  d  S(   Ns   -cs   import readlinet   TERMs   xterm-256colort    (   R   R   (   R   t   rct   stdoutt   stderr(    (    s#   lib/python2.7/test/test_readline.pyt	   test_init/   s    (   R   R   R   t   skipIfR   t   _READLINE_VERSIONR   R   (    (    (    s#   lib/python2.7/test/test_readline.pyR   -   s   c           C   s   t  t t  d  S(   N(   R    R   R   (    (    (    s#   lib/python2.7/test/test_readline.pyt	   test_main;   s    t   __main__(   R   t   osR   t   test.test_supportR    R   t   test.script_helperR   R   t   TestCaseR   R   R   R   (    (    (    s#   lib/python2.7/test/test_readline.pyt   <module>   s   !	