ó
Š]c           @   sÑ   d  Z  d d l Z d d l m Z d d l Z e j Z d e j k Z d d l m	 Z	 d d l m
 Z d Z e d Z d	 e j f d
 „  ƒ  YZ d e j f d „  ƒ  YZ e d k rÍ e j d d d e ƒ n  d S(   s6  Test warnings replacement in PyShell.py and run.py.

This file could be expanded to include traceback overrides
(in same two modules). If so, change name.
Revise if output destination changes (http://bugs.python.org/issue18318).
Make sure warnings module is left unaltered (http://bugs.python.org/issue18081).
iÿÿÿÿN(   t   captured_stderrt   idle(   t   run(   t   PyShellsf   
Warning (from warnings module):
  File "test_warning.py", line 99
    Line of code
UserWarning: Test
s   >>> t   RunWarnTestc           B   s,   e  Z e j e d  ƒ d „  ƒ Z d „  Z RS(   s#   Does not work when run within Idle.c         C   sZ   |  j  t j t ƒ t j t ƒ |  j  t j t j ƒ t j t ƒ |  j  t j t ƒ d  S(   N(   t   assertIst   warningst   showwarningR   t   capture_warningst   Truet   idle_showwarning_subproct   False(   t   self(    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyt   test_showwarnings"   s
    c         C   sT   t  ƒ  E } t j d t d d | d ƒ |  j t j ƒ  | j ƒ  j ƒ  ƒ Wd  QXd  S(   Nt   Tests   test_warning.pyic   s   Line of code(   R    R   R
   t   UserWarningt   assertEqualt   idlemsgt
   splitlinest   getvalue(   R   t   f(    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyt   test_run_show*   s    (   t   __name__t
   __module__t   unittestt   skipIft   running_in_idleR   R   (    (    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyR       s   t   ShellWarnTestc           B   s5   e  Z e j e d  ƒ d „  ƒ Z d „  Z d „  Z RS(   s#   Does not work when run within Idle.c         C   sZ   |  j  t j t ƒ t j t ƒ |  j  t j t j ƒ t j t ƒ |  j  t j t ƒ d  S(   N(   R   R   R   t   shellR   R	   t   idle_showwarningR   (   R   (    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyR   3   s
    c         C   s/   t  j d t d d d ƒ } |  j t | ƒ d  S(   NR   s   test_warning.pyic   s   Line of code(   R   t   idle_formatwarningR   R   R   (   R   t   s(    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyt   test_idle_formatter;   s    c         C   sT   t  ƒ  E } t j d t d d | d ƒ |  j t j ƒ  | j ƒ  j ƒ  ƒ Wd  QXd  S(   NR   s   test_warning.pyic   s   Line of code(   R    R   R   R   R   t   shellmsgR   R   (   R   R   (    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyt   test_shell_showA   s    (   R   R   R   R   R   R   R    R"   (    (    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyR   1   s   	t   __main__t	   verbosityi   t   exit(   t   __doc__R   t   test.test_supportR    R   R   R   R   t   idlelibR   R   R   R   R!   t   TestCaseR   R   t   mainR   (    (    (    s/   lib/python2.7/idlelib/idle_test/test_warning.pyt   <module>   s   		
