<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
 f%                 @   sN  d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	Z	ddl	m
Z
 ddlZddlmZ ejZejZi Zejd Zed< ejd Zed	< ejd Zed
< ejd Zed< dd Zdd ZG dd de	jZG dd de	jZG dd de	jZG dd de	jZG dd de	jZG dd de	jZedkrJe	j dd dS )zTest config, coverage 93%.
(100% for IdleConfParser, IdleUserConfParser*, ConfigChanges).
* Exception is OSError clause in Save method.
Much of IdleConf is also exercised by ConfigDialog and test_configdialog.
    )configN)captured_stderrfindfile)mock)Func main	highlightkeys
extensionsc               C   s   t t_dt_d S )NT)testcfgidleConfuserCfgidlelibtesting r   r   B/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_config.pysetUpModule   s    r   c               C   s   t t_dt_d S )NF)usercfgr   r   r   r   r   r   r   r   tearDownModule!   s    r   c               @   s4   e Zd ZdZdZdd Zdd Zdd Zd	d
 ZdS )IdleConfParserTestzTest that IdleConfParser worksz
        [one]
        one = false
        two = true
        three = 10

        [two]
        one = a string
        two = true
        three = false
    c             C   s   t jd}|j| j  | j}| j|jddddd | j|jddddd ||jddd	dd
 ||jddd | j|jddddd | j|jddddd ||jddd ||jddd | j|jdd ||jddddd d S )Nr   onebool)typeFtwoTthreeint
   za stringtruefalsenotZexistZDEFAULT)default)r   IdleConfParserread_stringassertEqualZassertIsGetZassertIsNone)selfparsereqr   r   r   test_get5   s    
zIdleConfParserTest.test_getc             C   s\   t jd}|j| j  |j}| j|ddddg | j|ddddg | j|dg  d S )Nr   r   r   r   z	not exist)r   r"   r#   GetOptionListassertCountEqualr$   )r&   r'   Zget_listr   r   r   test_get_option_listJ   s    
z'IdleConfParserTest.test_get_option_listc             C   s&   t jd}|j  | j|j g  d S )Nr   )r   r"   Loadr$   sections)r&   r'   r   r   r   test_load_nothingR   s    
z$IdleConfParserTest.test_load_nothingc             C   sF   t d}tj|}|j  | j|jddd | j|jddg d S )Nzcfgparser.1zFoo Barfoonewbar)r   r   r"   r-   r$   r%   r*   )r&   config_pathr'   r   r   r   test_load_fileW   s
    
z!IdleConfParserTest.test_load_fileN)	__name__
__module____qualname____doc__r   r)   r,   r/   r3   r   r   r   r   r   &   s   r   c               @   sR   e Zd ZdZdddZdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd ZdS )IdleUserConfParserTestz"Test that IdleUserConfParser worksr   c             C   s
   t j|S )N)r   IdleUserConfParser)r&   pathr   r   r   
new_parserd   s    z!IdleUserConfParserTest.new_parserc             C   s   | j  }|jd | j|jddd | j|jddd | j|jddd | j|jddd | j|jddd | j|j ddg | j|jddd d S )NFoobarr   r   Bar)	r;   add_section
assertTrue	SetOptionassertFalser$   r%   r+   r.   )r&   r'   r   r   r   test_set_optiong   s    
z&IdleUserConfParserTest.test_set_optionc             C   sZ   | j  }|jd |jddd | j|jdd | j|jdd | j|jdd d S )Nr<   r=   r   ZNotZExist)r;   
AddSectionrA   r@   ZRemoveOptionrB   )r&   r'   r   r   r   test_remove_optionw   s    
z)IdleUserConfParserTest.test_remove_optionc             C   sN   | j  }| j|j g  |jd |jd |jd | j|j ddg d S )Nr<   r>   )r;   r$   r.   rD   r+   )r&   r'   r   r   r   test_add_section   s    


z'IdleUserConfParserTest.test_add_sectionc             C   s^   | j  }|jd |jd |jddd | j|j dddg |j  | j|j dg d S )Nr<   r>   ZIdlenameval)r;   rD   rA   r+   r.   ZRemoveEmptySectionsr$   )r&   r'   r   r   r   test_remove_empty_sections   s    

z1IdleUserConfParserTest.test_remove_empty_sectionsc             C   sv   | j  }|jd |jd | j|j  | j|j g  |jddd |jd | j|j  | j|j dg d S )Nr<   r>   r=   r   )	r;   rD   r@   ZIsEmptyr$   r.   rA   rB   r+   )r&   r'   r   r   r   test_is_empty   s    


z$IdleUserConfParserTest.test_is_emptyc             C   s   t j r}tjj|d}| j|}|j  |jd |jddd |j	  | j
tjj| |j  | jtjj| W d Q R X d S )Nztest.cfgr<   r=   r   )tempfileTemporaryDirectoryosr:   joinr;   Z
RemoveFilerD   rA   Saver@   existsrB   )r&   tdirr:   r'   r   r   r   test_remove_file   s    


z'IdleUserConfParserTest.test_remove_filec             C   s   t j }tjj|d}| j|}|jd |jddd | jtjj	| |j
  | jtjj	| |jd |j
  | jtjj	| W d Q R X d S )Nztest.cfgr<   r=   r   )rK   rL   rM   r:   rN   r;   rD   rA   rB   rP   rO   r@   remove_section)r&   rQ   r:   r'   r   r   r   	test_save   s    



z IdleUserConfParserTest.test_saveN)r   )r4   r5   r6   r7   r;   rC   rE   rF   rI   rJ   rR   rT   r   r   r   r   r8   a   s   
	
r8   c               @   s,  e Zd ZdZedd Zedd ZdAddZd	d
 Ze	j
ejjdddd Ze	j
ejjd ddd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Z d4d5 Z!d6d7 Z"d8d9 Z#d:d; Z$d<d= Z%d>d? Z&d@S )BIdleConfTestzTest for idleConfc             C   s   i | _ tjdd}tdkr(tjjt}ntjjt	jd }xD|j
D ]:}tjj|d| }t|d}|j | j |< W d Q R X qBW tj| _t t_d S )NT)_utest__main__r   z../config-%s.defr)config_stringr   IdleConfr4   rM   r:   dirname__file__abspathsysconfig_typesrN   openread_warn	orig_warnr   )clsconfidle_dirctyper2   fr   r   r   
setUpClass   s    zIdleConfTest.setUpClassc             C   s   | j t_d S )N)rc   r   rb   )rd   r   r   r   tearDownClass   s    zIdleConfTest.tearDownClassFc             C   s   t j|dS )N)rV   )r   rZ   )r&   rV   r   r   r   
new_config   s    zIdleConfTest.new_configc             C   sl   t jdd}xZ|jD ]P}t jd|j|< |j| j| j|  t jd|j|< |j| j| j|  qW |S )zbReturn a mocked idleConf

        Both default and user config used the same config-*.def
        T)rV   r   )	r   rZ   r_   r"   
defaultCfgr#   rY   r9   r   )r&   re   rg   r   r   r   mock_config   s    zIdleConfTest.mock_configwinzthis is test for unix systemc          :   C   s   | j dd}tjddd0 tjddd | j|j d W dQ R X W dQ R X tjdd	dF tjd
dd, tjd | j|j d W dQ R X W dQ R X W dQ R X tjddd: | jt$ | jt |j  W dQ R X W dQ R X W dQ R X dS )z,Test to get user config directory under unixT)rV   zos.path.expanduserz	/home/foo)return_valuezos.path.existsz/home/foo/.idlercN~z	os.getcwdz/home/foo/cpythonzos.mkdirz/home/foo/cpython/.idlerczos.path.joinz/path/not/exists)rk   r   patchr$   GetUserCfgDirassertRaises
SystemExitFileNotFoundError)r&   re   r   r   r   test_get_user_cfg_dir_unix   s    $
$z'IdleConfTest.test_get_user_cfg_dir_unixzthis is test for Windows systemc          :   C   s   | j dd}tjddd0 tjddd | j|j d W dQ R X W dQ R X tjdd	dF tjd
dd, tjd | j|j d W dQ R X W dQ R X W dQ R X tjddd: | jt$ | jt |j  W dQ R X W dQ R X W dQ R X dS )z/Test to get user config directory under WindowsT)rV   zos.path.expanduserzC:\foo)ro   zos.path.existszC:\foo\.idlercNrp   z	os.getcwdzC:\foo\cpythonzos.mkdirzC:\foo\cpython\.idlerczos.path.joinz/path/not/exists)rk   r   rq   r$   rr   rs   rt   ru   )r&   re   r   r   r   test_get_user_cfg_dir_windows  s    $
$z*IdleConfTest.test_get_user_cfg_dir_windowsc             C   s(  | j dd}d}tjjddi( tjd|d |j  W d Q R X W d Q R X | j|jj |j | j|j	j |j x |jj
 D ]}| j|tj qW x |j	j
 D ]}| j|tj qW x2|jj D ]$\}}| j|jtjj|d|  qW x4|j	j D ]&\}}| j|jtjj|jd	|  qW d S )
NT)rV   z	/home/foor4   Z__foo__zos.path.dirname)ro   zconfig-%s.defzconfig-%s.cfg)rk   r   rq   dictZCreateConfigHandlersr+   rl   r
   r_   r   valuesZassertIsInstancer   r"   r9   itemsr$   filerM   r:   rN   Zuserdir)r&   re   rf   Zdefault_parserZuser_parserZconfig_typer'   r   r   r   test_create_config_handlers  s"    z(IdleConfTest.test_create_config_handlersc             C   s   | j dd}td}tj||jd< tj||jd< |j  | j}||jd j	ddd ||jd j
ddg ||jd j	ddd ||jd j
ddg d S )NT)rV   zcfgparser.1r0   zFoo Barr1   )rk   r   r   r"   rl   r9   r   ZLoadCfgFilesr$   r%   r*   )r&   re   r2   r(   r   r   r   test_load_cfg_files3  s    z IdleConfTest.test_load_cfg_filesc             C   s>   | j  }tjd"}|j  | j|jt|j W d Q R X d S )Nz&idlelib.config.IdleUserConfParser.Save)rm   r   rq   ZSaveUserCfgFilesr$   
call_countlenr   )r&   re   mr   r   r   test_save_user_cfg_filesH  s    z%IdleConfTest.test_save_user_cfg_filesc             C   s   | j  }| j}||jdddd ||jdddddd tjdV}||jddd	ddd  ||jddd
d  ||jddd
ddd ||jd W d Q R X d S )Nr   EditorWindowwidthZ80r   )r   P   zidlelib.config._warnZfont	NotExistsZNE)r!      )rm   r$   	GetOptionr   rq   r~   )r&   re   r(   rb   r   r   r   test_get_optionO  s    zIdleConfTest.test_get_optionc             C   s2   | j  }|jdddd | j|jdddd d S )Nr   r<   r=   r1   )rm   rA   r$   r   )r&   re   r   r   r   rC   [  s    zIdleConfTest.test_set_optionc             C   s   | j  }| j|jddddddddd	d
g | j|jddddddddd	d
g | jtj |jdd W d Q R X | jtj |jdd W d Q R X d S )Nr!   r   ZGeneralr   ZPyShellIndentThemeKeysZHistory	HelpFilesuserZfoobarZ	notexists)rm   r+   GetSectionListrs   r   InvalidConfigSetZInvalidConfigType)r&   re   r   r   r   test_get_section_lista  s    



z"IdleConfTest.test_get_section_listc             C   s   | j  }| j}||jddddd ||jdddd ||jdddd | jtj |jddd W d Q R X ||jdd	d
dd |jdddd |jdddd tjd ||jddddd W d Q R X d S )NzIDLE ClassicZnormalz#000000z#ffffff)Z
foregroundZ
backgroundZfgZbgZfbZcursorZblackr	   Foobarznormal-foregroundz#747474znormal-backgroundz#171717zidlelib.config._warn)	rm   r$   ZGetHighlightrs   r   ZInvalidFgBgrA   r   rq   )r&   re   r(   r   r   r   test_get_highlightr  s    

zIdleConfTest.test_get_highlightc          
   C   sL   | j  }| j|jdd|jdd | jtj |jdd W dQ R X dS )zXXX: NOT YET DONEr!   zIDLE Classicr   badN)rm   r$   ZGetThemeDictrs   r   ZInvalidTheme)r&   re   r   r   r   test_get_theme_dict  s    
z IdleConfTest.test_get_theme_dictc             C   s8   | j  }| j|j |jd | j|j |jd d S )Nr   r   )rm   r$   ZCurrentThemecurrent_colors_and_keysCurrentKeys)r&   re   r   r   r   test_get_current_theme_and_keys  s    z,IdleConfTest.test_get_current_theme_and_keysc             C   s   | j  }| j|jdd d S )Nr   zIDLE Classic)rm   r$   r   )r&   re   r   r   r   test_current_colors_and_keys  s    z)IdleConfTest.test_current_colors_and_keysc             C   s^   t j}| jdd}dt _| j|j d dt _| j|j d dt _| j|j d |t _d S )	NT)rV   Zwin32zIDLE Classic WindowsdarwinzIDLE Classic OSXz
some-linuxzIDLE Modern Unix)r^   platformrk   r$   default_keys)r&   current_platformre   r   r   r   test_default_keys  s    zIdleConfTest.test_default_keysc             C   s   t jd | j}tj}||ddg  || dg ||dddg ||ddddg ||ddd	ddg t jd t jd d S )
Nzn
            [ZzDummy]
            enable = True
            [DISABLE]
            enable = False
            T)Z
shell_onlyZzDummy)editor_onlyF)active_onlyZDISABLE)r   r   )userextnr#   r$   r   ZGetExtensionsrS   )r&   r(   ZiGEr   r   r   test_get_extensions  s    
z IdleConfTest.test_get_extensionsc             C   s0   | j  }| j|j|jdddddddg d S )Nr!   r   ZAutoCompleteZCodeContextZFormatParagraphZ
ParenMatchr   )rm   r+   ZRemoveKeyBindNamesr   )r&   re   r   r   r   test_remove_key_bind_names  s    z'IdleConfTest.test_remove_key_bind_namesc             C   s>   t jd | j}|tjdd |tjdd  t jd d S )Nz=
            [ZzDummy]
            enable = True
            zz-inr   zz-out)r   r#   r$   r   ZGetExtnNameForEventrS   )r&   r(   r   r   r   test_get_extn_name_for_event  s    z)IdleConfTest.test_get_extn_name_for_eventc             C   s0   t jd | jtjdddgi t jd d S )Nz=
            [ZzDummy]
            enable = True
            r   z<<z-in>>z!<Control-Shift-KeyRelease-Insert>)r   r#   r$   r   ZGetExtensionKeysrS   )r&   r   r   r   test_get_extension_keys  s
    z$IdleConfTest.test_get_extension_keysc             C   sN   t jd | j}tj}||di  dgdgd}||d| t jd d S )Nz=
            [ZzDummy]
            enable = True
            r   z!<Control-Shift-KeyRelease-Insert>z!<Control-Shift-KeyRelease-Delete>)z<<z-in>>z	<<z-out>>r   )r   r#   r$   r   ZGetExtensionBindingsrS   )r&   r(   ZiGEBZexpectr   r   r   test_get_extension_bindings  s    
z(IdleConfTest.test_get_extension_bindingsc             C   s   | j  }| j}||jddddg ||jddddg ||jddd	d
g ||jdddg ||jdddg ||jddg  ||jddg  d S )NzIDLE Modern Unixz<<copy>>z<Control-Shift-Key-C>z<Control-Key-Insert>zIDLE Classic Unixz<Alt-Key-w>z<Meta-Key-w>zIDLE Classic Windowsz<Control-Key-c>z<Control-Key-C>zIDLE Classic Macz<Command-Key-c>zIDLE Classic OSXz
NOT EXISTS)rm   r$   ZGetKeyBinding)r&   re   r(   r   r   r   test_get_keybinding  s    


z IdleConfTest.test_get_keybindingc             C   s8   t j}| j }dt _| j|j |j|j  |t _d S )Nz
some-linux)r^   r   rm   r$   ZGetCurrentKeySet	GetKeySetr   )r&   r   re   r   r   r   test_get_current_keyset  s
    	z$IdleConfTest.test_get_current_keysetc             C   sj   | j  }|jd jd |jd jd |jd jddd |jd jddd | j|jdd	 d
 d S )Nr   r   ZFoobar_cfgBindingsenableTrueZnewfooz<Key-F3>zIDLE Modern Unixz
<<newfoo>>r   )rm   rl   r?   setr$   r   )r&   re   r   r   r   test_get_keyset  s    zIdleConfTest.test_get_keysetc             C   sL   | j  }| j|jd | j|jd | j|jd | j|jd d S )NcopyZcutzdel-word-rightz
not-exists)rm   r@   ZIsCoreBindingrB   )r&   re   r   r   r   test_is_core_binding  s
    z!IdleConfTest.test_is_core_bindingc             C   s  | j  }| j|jdg  | j|jdg  | jtj | j|jdg  W d Q R X | j|j |jd|jd  |jd j	ddd |jd j	ddd	 |jd j	dd
d |jd j	ddd | j|jddddg | j|j |jd|jd  d S )Nr!   r   r   r   r   4zPython;https://python.org3zPython:https://python.org2z/Pillow;https://pillow.readthedocs.io/en/latest/1z/IDLE;C:/Programs/Python36/Lib/idlelib/help.htmlIDLE*C:/Programs/Python36/Lib/idlelib/help.htmlPillow(https://pillow.readthedocs.io/en/latest/Pythonhttps://python.org)r   r   r   )r   r   r   )r   r   r   )
rm   r$   ZGetExtraHelpSourceListrs   r   r   r+   ZGetAllExtraHelpSourcesListr   rA   )r&   re   r   r   r   test_extra_help_source_list   s&    z(IdleConfTest.test_extra_help_source_listc             C   s   ddl m} ddlm} ddlm} | j }|d | }|j  |j|dd|d}| j	|j
|d	d
|d |d dkr|dn|d |d f |j  ~d S )Nr   )requires)Tk)FontZguiZTkFixedFontT)rG   rP   rootr   r   Zfamilysizer   Zweight)test.supportr   Ztkinterr   Ztkinter.fontr   rm   ZwithdrawZactualr$   ZGetFontZdestroy)r&   r   r   r   re   r   rh   r   r   r   test_get_font;  s    (zIdleConfTest.test_get_fontc             C   s   | j  }| j}||j d dg ||j d ddg ||j d dg ||jdd d	d
g ||jdd dg ||jdd ddg ||jdd ddg d S )Nz<<center-insert>>z<Control-l>z<<copy>>z<Control-c>z<Control-C>z<<history-next>>z<Alt-n>zIDLE Classic Windowsz<Control-Key-l>z<Control-Key-L>zIDLE Classic OSXz<Command-Key-c>zIDLE Classic Unixz<Alt-Key-n>z<Meta-Key-n>zIDLE Modern Unix)rm   r$   ZGetCoreKeys)r&   re   r(   r   r   r   test_get_core_keysN  s    

zIdleConfTest.test_get_core_keysN)F)'r4   r5   r6   r7   classmethodri   rj   rk   rm   unittestZskipIfr^   r   
startswithrv   rw   r|   r}   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rU      s<   


	rU   c               @   sR   e Zd ZdZejZdZej Zdd Z	dd Z
dd Zd	d
 Zdd Zdd ZdS )CurrentColorKeysTesta   Test colorkeys function with user config [Theme] and [Keys] patterns.

        colorkeys = config.IdleConf.current_colors_and_keys
        Test all patterns written by IDLE and some errors
        Item 'default' should really be 'builtin' (versus 'custom).
    zIDLE Classicc             C   s~   | j | jd| j tjd | j | jd| j dtd d< | j | jdd dtd d< | j | jd| j tjd d S )Nr   z<
            [Theme]
            default = True
            zIDLE NewrG   znon-existent)r$   	colorkeysdefault_themeusermainr#   rS   )r&   r   r   r   test_old_builtin_themei  s    z+CurrentColorKeysTest.test_old_builtin_themec             C   sh   t jd | j| jdd dt d d< | j| jdd dt d d< | j| jd| j t jd d S )NzZ
            [Theme]
            default = True
            name2 = IDLE Dark
            r   z	IDLE DarkzIDLE NewrG   znon-existentname2)r   r#   r$   r   r   rS   )r&   r   r   r   test_new_builtin_theme{  s    z+CurrentColorKeysTest.test_new_builtin_themec             C   sp   t jd | j| jd| j tjd | j| jdd dt d d< | j| jdd t jd tjd d S )Nz\
            [Theme]
            default = False
            name = Custom Dark
            r   z[Custom Dark]
a=bzCustom Darkznon-existentr   )r   r#   r$   r   r   userhighrS   )r&   r   r   r   test_user_override_theme  s    

z-CurrentColorKeysTest.test_user_override_themec             C   s^   | j | jd| j tjd | j | jdd dtd d< | j | jd| j tjd d S )Nr   z`
            [Keys]
            default = True
            name = IDLE Classic Unix
            zIDLE Classic Unixznon-existentrG   )r$   r   r   r   r#   rS   )r&   r   r   r   test_old_builtin_keys  s    z*CurrentColorKeysTest.test_old_builtin_keysc             C   sh   t jd | j| jdd dt d d< | j| jdd dt d d< | j| jd| j t jd d S )Nz`
            [Keys]
            default = True
            name2 = IDLE Modern Unix
            r   zIDLE Modern UnixzIDLE Classic UnixrG   znon-existentr   )r   r#   r$   r   r   rS   )r&   r   r   r   test_new_builtin_keys  s    z*CurrentColorKeysTest.test_new_builtin_keysc             C   sp   t jd | j| jd| j tjd | j| jdd dt d d< | j| jdd t jd tjd d S )Nz[
            [Keys]
            default = False
            name = Custom Keys
            r   z[Custom Keys]
a=bzCustom Keysznon-existentr   )r   r#   r$   r   r   userkeysrS   )r&   r   r   r   test_user_override_keys  s    

z,CurrentColorKeysTest.test_user_override_keysN)r4   r5   r6   r7   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ^  s   r   c               @   s   e Zd Zi i i i dZdd Zdddiiddd	iid
ddiii dZdd Zdd Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS ) ChangesTest)r   r	   r
   r   c             C   s:   | j }|jdddd |jdddd |jd	d
dd |S )Nr   Msecmitemmvalr	   Hsechitemhvalr
   Kseckitemkval)changes
add_option)r&   r   r   r   r   load  s
    zChangesTest.loadr   r   r   r   r   r   r   r   r   c             C   s   t j | _d S )N)r   ZConfigChangesr   )r&   r   r   r   setUp  s    zChangesTest.setUpc             C   s   | j | j| j d S )N)r$   r   empty)r&   r   r   r   	test_init  s    zChangesTest.test_initc             C   s8   | j  }| j|| j |jdddd | j|| j d S )Nr   r   r   r   )r   r$   loadedr   )r&   r   r   r   r   test_add_option  s    zChangesTest.test_add_optionc             C   s   | j j}| j|dddd | j|dddd | jtd d d | j|dddd | jtd d d | j|dddd | jtjdd tjd d S )Nr   r   Zwhat0z
use-spacesr   )r   save_optionr@   rB   r$   r   
has_optionrS   )r&   r   r   r   r   test_save_option  s    zChangesTest.test_save_optionc             C   s   | j  }| j|j  | jtd d d | jtd d d | jtd d d	 |jd
ddd | j|j  tj	d tj	d tj	d d S )Nr   r   r   r   r   r   r   r   r   r   )
r   r@   save_allr$   r   r   r   r   rB   rS   )r&   r   r   r   r   test_save_added  s    

zChangesTest.test_save_addedc             C   sV   | j }|jdddd |jdddd |j  | jtjdd | jtjdd d S )Nr   r   r   ZidledocZELDIZcodeldi)r   r   r   r   rB   r   r   r@   )r&   r   r   r   r   test_save_help  s    zChangesTest.test_save_helpc             C   s   | j }|jdddd d S )Nr   r   z
use-spacesr   )r   r   )r&   r   r   r   r   test_save_default
  s    zChangesTest.test_save_defaultc          
   C   s   | j  }|jdd | j|| j x\d
D ]T\}}t| j|dd |j|| | jt || |  t| |  W d Q R X q(W d S )Nr   Zfaker   r
   r   rG   valuer   r   r
   r   )r   r   )r   Zdelete_sectionr$   r   r   rA   rs   KeyError)r&   r   ZcfgtypeZsectionr   r   r   test_delete_section  s    zChangesTest.test_delete_sectionc             C   s"   | j  }|j  | j|| j d S )N)r   clearr$   r   )r&   r   r   r   r   
test_clear  s    zChangesTest.test_clearN)r4   r5   r6   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s   


	r   c               @   s   e Zd Zdd ZdS )WarningTestc             C   s   | j }t t_t }tjdd W d Q R X |tjdh ||j d t }tjdd W d Q R X ||j d t }tjdd W d Q R X |tjd	d
h ||j d d S )Nwarningkey
r   warn2yek)r   r   zwarning
)r   r   )r   r   zwarn2
)r$   r   r   Z_warnedr   rb   getvalue)r&   ZEqualstderrr   r   r   	test_warn%  s    zWarningTest.test_warnN)r4   r5   r6   r   r   r   r   r   r   #  s   r   rW      )	verbosity)!r7   r   r   r^   rM   rK   r   r   r   r   r   Zidlelib.idle_test.mock_idler   r   r   r   r   r9   r   r   r   r   r   r   ZTestCaser   r8   rU   r   r   r   r4   r   r   r   r   r   <module>   s:   ;`    oV
