
    z%i)}                        	 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      xZed<    ej                   d      xZed<    ej                   d      xZed	<    ej                   d      xZed
<   d Zd Z G d dej.                        Z G d dej.                        Z G d dej.                        Z G d dej.                        Z G d dej.                        Z G d dej.                        Zedk(  r ej>                  d       yy)    )configN)captured_stderrfindfile)mock)Func main	highlightkeys
extensionsc                  8    t         t        _        dt        _        y )NT)testcfgidleConfuserCfgidlelibtesting     Q/home/uftp/.pyenv/versions/3.12.0/lib/python3.12/idlelib/idle_test/test_config.pysetUpModuler      s    HGOr   c                  8    t         t        _        dt        _        y )NF)usercfgr   r   r   r   r   r   r   tearDownModuler   !   s    HGOr   c                   *    e Zd Z	 dZd Zd Zd Zd Zy)IdleConfParserTestz
        [one]
        one = false
        two = true
        three = 10

        [two]
        one = a string
        two = true
        three = false
    c                    t        j                  d      }|j                  | j                          | j                  }| j	                  |j                  ddd      d       | j	                  |j                  ddd      d        ||j                  ddd	      d
        ||j                  dd      d       | j	                  |j                  ddd      d       | j	                  |j                  ddd      d        ||j                  dd      d        ||j                  dd      d       | j                  |j                  dd              ||j                  ddd      d       y )Nr   onebooltypeFtwoTthreeint
   za stringtruefalsenotexistDEFAULTdefault)r   IdleConfParserread_stringassertEqualassertIsGetassertIsNone)selfparsereqs      r   test_getzIdleConfParserTest.test_get5   s3   &&r*4;;' 	fjjFj;UCfjjFj;TB
6::eW5:126
6::eU#Z0fjjFj;TBfjjfj=uE 	6::eU#V,
6::eW%w/ 	&**UG45
6::eWi:8)Dr   c                    t        j                  d      }|j                  | j                          |j                  }| j	                   |d      g d       | j	                   |d      g d       | j                   |d      g        y )Nr   r   )r   r!   r"   r!   z	not exist)r   r,   r-   GetOptionListassertCountEqualr.   )r2   r3   get_lists      r   test_get_option_listz'IdleConfParserTest.test_get_option_listJ   sn    &&r*4;;'''huo/FGhuo/FG+.3r   c                     t        j                  d      }|j                          | j                  |j	                         g        y )Nr   )r   r,   Loadr.   sectionsr2   r3   s     r   test_load_nothingz$IdleConfParserTest.test_load_nothingR   s2    &&r**B/r   c                     t        d      }t        j                  |      }|j                          | j	                  |j                  dd      d       | j	                  |j                  d      dg       y )Ncfgparser.1Foo Barfoonewbar)r   r   r,   r<   r.   r0   r7   )r2   config_pathr3   s      r   test_load_filez!IdleConfParserTest.test_load_fileW   s]    }-&&{3Iu5x@--i85'Br   N)__name__
__module____qualname__r   r5   r:   r?   rF   r   r   r   r   r   &   s"    (
FE*40
Cr   r   c                   :    e Zd Z	 d	dZd Zd Zd Zd Zd Zd Z	y)
IdleUserConfParserTestc                 ,    t        j                  |      S N)r   IdleUserConfParser)r2   paths     r   
new_parserz!IdleUserConfParserTest.new_parserd   s    ((..r   c                 "   | 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       y )NFoobarr%   r&   Bar)	rP   add_section
assertTrue	SetOptionassertFalser.   r0   r8   r=   r>   s     r   test_set_optionz&IdleUserConfParserTest.test_set_optiong   s    "5!((v>?))%?@((w?@E517; 	((v>?foo/%@E516:r   c                 2   | j                         }|j                  d       |j                  ddd       | j                  |j	                  dd             | j                  |j	                  dd             | j                  |j	                  dd             y )NrR   rS   r%   NotExist)rP   
AddSectionrW   rV   RemoveOptionrX   r>   s     r   test_remove_optionz)IdleUserConfParserTest.test_remove_optionw   s}    "% v.++E59:,,UE:;,,UG<=r   c                    | j                         }| j                  |j                         g        |j                  d       |j                  d       |j                  d       | j	                  |j                         ddg       y )NrR   rT   )rP   r.   r=   r]   r8   r>   s     r   test_add_sectionz'IdleUserConfParserTest.test_add_section   sl    "*B/ 	% % % foo/%@r   c                 4   | j                         }|j                  d       |j                  d       |j                  ddd       | j                  |j	                         g d       |j                          | j                  |j	                         dg       y )NrR   rT   Idlenameval)rT   rR   rc   )rP   r]   rW   r8   r=   RemoveEmptySectionsr.   r>   s     r   test_remove_empty_sectionsz1IdleUserConfParserTest.test_remove_empty_sections   sy    "% % /foo/1GH""$*VH5r   c                    | j                         }|j                  d       |j                  d       | j                  |j                                | j	                  |j                         g        |j                  ddd       |j                  d       | j                  |j                                | j                  |j                         dg       y )NrR   rT   rS   r&   )	rP   r]   rV   IsEmptyr.   r=   rW   rX   r8   r>   s     r   test_is_emptyz$IdleUserConfParserTest.test_is_empty   s    "% % ()*B/w/% )*foo/%9r   c                 v   t        j                         5 }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                  |             d d d        y # 1 sw Y   y xY w)Nztest.cfgrR   rS   r%   )tempfileTemporaryDirectoryosrO   joinrP   r]   rW   rX   existsSaverV   remove_section)r2   tdirrO   r3   s       r   	test_savez IdleUserConfParserTest.test_save   s    ((* 	3d77<<j1D__T*Fe$UE62 RWW^^D12KKMOOBGGNN401 !!%(KKMRWW^^D12	3 	3 	3s   DD//D8N)r   )
rG   rH   rI   rP   rY   r_   ra   rg   rj   rt   r   r   r   rK   rK   a   s)    ,/; >	A6:3r   rK   c                      e Zd Z	 ed        Zed        Zd"dZd Z ej                  e
j                  j                  d      d      d        Z ej                  e
j                  j                  d       d      d	        Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d  Z%y!)#IdleConfTestc                 *   i | _         t        j                  d      }t        dk7  r$t        j
                  j                  t              }n0t        j
                  j                  t        j
                  d         }|j                  D ]V  }t        j
                  j                  |d|z        }t        |      5 }|j                         | j                   |<   d d d        X t        j                  | _        t!               t        _        y # 1 sw Y   xY w)NT_utest__main__r   z../config-%s.def)config_stringr   IdleConfrG   rn   rO   dirname__file__abspathsysconfig_typesro   openread_warn	orig_warnr   )clsconfidle_dirctyperE   fs         r   
setUpClasszIdleConfTest.setUpClass   s    d+z!wwx0Hwwsxx{3H&& 	4E'',,x1Ce1KLKk" 4a+,668!!%(4 4	4
 v	4 4s   8D		D	c                 .    | j                   t        _        y rM   )r   r   r   )r   s    r   tearDownClasszIdleConfTest.tearDownClass   s    }}r   c                 .    t        j                  |      S )Nrx   )r   r|   )r2   ry   s     r   
new_configzIdleConfTest.new_config   s    f--r   c                    	 t        j                  d      }|j                  D ]  }t        j                  d      |j                  |<   |j                  |   j                  | j                  |          t        j                  d      |j                  |<   |j                  |   j                  | j                  |           |S )NTrx   r   )	r   r|   r   r,   
defaultCfgr-   r{   rN   r   )r2   r   r   s      r   mock_configzIdleConfTest.mock_config   s    	 d+&& 	GE%+%:%:2%>DOOE"OOE"..t/A/A%/HI"(";";B"?DLLLL++D,>,>u,EF		G r   winzthis is test for unix systemc                 ~   | j                  d      }t        j                  dd      5  t        j                  dd      5  | j                  |j	                         d       d d d        d d d        t        j                  dd      5  t        j                  d	d
      5  t        j                  d      5  | j                  |j	                         d       d d d        d d d        d d d        t        j                  dd      5  | j                  t              5  | j                  t              5  |j	                          d d d        d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   WxY w# 1 sw Y   [xY w# 1 sw Y   y xY w)NTrx   os.path.expanduser	/home/fooreturn_valueos.path.existsz/home/foo/.idlerc~	os.getcwdz/home/foo/cpythonos.mkdirz/home/foo/cpython/.idlercos.path.join/path/not/existsr   r   patchr.   GetUserCfgDirassertRaises
SystemExitFileNotFoundErrorr2   r   s     r   test_get_user_cfg_dir_unixz'IdleConfTest.test_get_user_cfg_dir_unix   s    d+ ZZ,;G 	L,4@ L  !3!3!57JKL	L
 ZZ,3? 	BK6IJ BZZ
+ B$$T%7%7%9%@BBB	B ZZ5GH 	)"":. )&&'89 )&&())	) 	)L L	L 	LB BB B	B 	B) )) )	) 	)   E*!E#E*
F"F8!E7F!FF3F'4FF'F3E'	#E**E47F <FF	FFF$ F''F0	,F33F<zthis is test for Windows systemc                 ~   | j                  d      }t        j                  dd      5  t        j                  dd      5  | j                  |j	                         d       d d d        d d d        t        j                  dd      5  t        j                  d	d
      5  t        j                  d      5  | j                  |j	                         d       d d d        d d d        d d d        t        j                  dd      5  | j                  t              5  | j                  t              5  |j	                          d d d        d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   WxY w# 1 sw Y   [xY w# 1 sw Y   y xY w)NTrx   r   zC:\foor   r   zC:\foo\.idlercr   r   zC:\foo\cpythonr   zC:\foo\cpython\.idlercr   r   r   r   s     r   test_get_user_cfg_dir_windowsz*IdleConfTest.test_get_user_cfg_dir_windows   s    d+ ZZ,9E 	K,4@ K  !3!3!57IJK	K
 ZZ,3? 	BK6HI BZZ
+ B$$T%7%7%9%@BBB	B ZZ5GH 	)"":. )&&'89 )&&())	) 	)K K	K 	KB BB B	B 	B) )) )	) 	)r   c           
      |   | j                  d      }d}t        j                  j                  ddi      5  t        j                  d|      5  |j	                          d d d        d d d        | j                  |j                  j                         |j                         | j                  |j                  j                         |j                         |j                  j                         D ]"  }| j                  |t        j                         $ |j                  j                         D ]"  }| j                  |t        j                         $ |j                  j                         D ]C  \  }}| j!                  |j"                  t$        j&                  j)                  |d| d	             E |j                  j                         D ]Q  \  }}| j!                  |j"                  t$        j&                  j)                  |j*                  xs d
d| d             S y # 1 sw Y   xY w# 1 sw Y   xY w)NTrx   r   rG   __foo__zos.path.dirnamer   zconfig-z.def#z.cfg)r   r   r   dictCreateConfigHandlersr8   r   r   r   r   valuesassertIsInstancer   r,   rN   itemsr.   filern   rO   ro   userdir)r2   r   r   default_parseruser_parsercfg_typer3   s          r   test_create_config_handlersz(IdleConfTest.test_create_config_handlers  s   d+ ZZ__j)45 	,-HE ,))+,	,
 	doo224d6G6GHdll//143D3DE #oo446 	IN!!.&2G2GH	I<<..0 	JK!!+v/H/HI	J !% 5 5 7 	OHfV[[WW\\(ghZt4LMO	O !% 2 2 4 	ZHfV[[WW\\$,,*=#
RV?WXZ	Z#, ,	, 	,s#   H1H$H1$H.	)H11H;c                 .   | j                  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       y )NTrx   rA   rC   rB   rD   )r   r   r   r,   r   rN   r   LoadCfgFilesr.   r0   r7   )r2   r   rE   r4   s       r   test_load_cfg_filesz IdleConfTest.test_load_cfg_files&  s    d+ }-!'!6!6{!C$77DU 	 	4??5!%%i7B
4??5!//	:UGD 	4<<""9e4h?
4<<,,Y7%Ar   c                     | j                         }t        j                  d      5 }|j                          | j	                  |j
                  t        |j                               d d d        y # 1 sw Y   y xY w)Nz&idlelib.config.IdleUserConfParser.Save)r   r   r   SaveUserCfgFilesr.   
call_countlenr   )r2   r   ms      r   test_save_user_cfg_filesz%IdleConfTest.test_save_user_cfg_files;  s]    !ZZ@A 	>Q!!#Q\\3t||+<=	> 	> 	>s   A A//A8c           	         | j                         }| j                  } ||j                  ddd      d        ||j                  dddd      d       t        j                  d      5 } ||j                  ddd	d      d         ||j                  ddd
      d         ||j                  ddd
d      d        ||j
                  d       d d d        y # 1 sw Y   y xY w)Nr	   EditorWindowwidth80r#   r   P   idlelib.config._warnfont	NotExistsNEr*      )r   r.   	GetOptionr   r   r   )r2   r   r4   r   s       r   test_get_optionzIdleConfTest.test_get_optionB  s    !
4>>&.':DA
4>>&.'>FKZZ./ 	$5t~~fnf5~I4Pt~~fnkBDIt~~fnk4~PRVWu#		$ 	$ 	$s   (A&CC c                     | j                         }|j                  dddd       | j                  |j                  ddd      d       y )Nr	   rR   rS   rD   )r   rW   r.   r   r   s     r   rY   zIdleConfTest.test_set_optionN  s?    !vueX6u=xHr   c                    | j                         }| j                  |j                  dd      g d       | j                  |j                  dd      g d       | j                  t        j
                        5  |j                  dd       d d d        | j                  t        j                        5  |j                  dd       d d d        y # 1 sw Y   DxY w# 1 sw Y   y xY w)Nr+   r	   )Generalr   PyShellIndentThemeKeysHistory	HelpFilesuserfoobar	notexists)r   r8   GetSectionListr   r   InvalidConfigSetInvalidConfigTyper   s     r   test_get_section_listz"IdleConfTest.test_get_section_listT  s    !	62-	. 	/-	.
 v667 	2&1	2v778 	8	;7	8 	8	2 	2	8 	8s   8C2CCC#c                    | j                         }| j                  } ||j                  dd      ddd        ||j                  dd      ddd       |j                  dd	d
d       |j                  dd	dd       t	        j
                  d      5   ||j                  d	d      ddd       d d d        y # 1 sw Y   y xY w)NIDLE Classicnormalz#000000z#ffffff)
foreground
backgroundcursorblackr
   Foobarznormal-foregroundz#747474znormal-backgroundz#171717r   )r   r.   GetHighlightrW   r   r   r2   r   r4   s      r   test_get_highlightzIdleConfTest.test_get_highlighte  s    !
4^X6yGP9R 	S 	4^X6wGP9R 	S 	{H.A9M{H.A9MZZ./ 	Qt  84YEN7P Q	Q 	Q 	Qs   B88Cc                    | j                         }| j                  |j                  dd      |j                  dd             | j                  t        j
                        5  |j                  dd       d d d        y # 1 sw Y   y xY w)Nr+   r   r   bad)r   r.   GetThemeDictr   r   InvalidThemer   s     r   test_get_theme_dictz IdleConfTest.test_get_theme_dictw  s{    ! 	i8fn5	7 v223 	5e^4	5 	5 	5s   "A>>Bc                     | j                         }| j                  |j                         |j                  d             | j                  |j	                         |j                  d             y )Nr   r   )r   r.   CurrentThemecurrent_colors_and_keysCurrentKeysr   s     r   test_get_current_theme_and_keysz,IdleConfTest.test_get_current_theme_and_keys  sX    !**,d.J.J7.ST))+T-I-I&-QRr   c                 f    | j                         }| j                  |j                  d      d       y )Nr   r   )r   r.   r   r   s     r   test_current_colors_and_keysz)IdleConfTest.test_current_colors_and_keys  s+    !55g>Or   c                 `   t         j                  }| j                  d      }dt         _        | j                  |j	                         d       dt         _        | j                  |j	                         d       dt         _        | j                  |j	                         d       |t         _        y )	NTrx   win32IDLE Classic WindowsdarwinIDLE Classic OSX
some-linuxIDLE Modern Unix)r   platformr   r.   default_keysr2   current_platformr   s      r   test_default_keyszIdleConfTest.test_default_keys  s    <<d+**,.DE**,.@A#**,.@A (r   c                 d   t         j                  d       | j                  }t        j                  } | |d      g         | |       dg        | |d      dg        | |d      ddg        | |dd	      ddg       t         j                  d       t         j                  d       y )
Nzn
            [ZzDummy]
            enable = True
            [DISABLE]
            enable = False
            T)
shell_onlyZzDummy)editor_onlyF)active_onlyDISABLE)r  r  )userextnr-   r.   r   GetExtensionsrr   )r2   r4   iGEs      r   test_get_extensionsz IdleConfTest.test_get_extensions  s      	 $$
3$$
359+
34 9+.
35!Iy#9:
35d3i5KL	*	*r   c                     | j                         }| j                  |j                  |j                  dd            g d       y )Nr+   r   )AutoCompleteCodeContextFormatParagraph
ParenMatchr  )r   r8   RemoveKeyBindNamesr   r   s     r   test_remove_key_bind_namesz'IdleConfTest.test_remove_key_bind_names  s=    !##D$7$7	<$PQW	Yr   c                     t         j                  d       | j                  } |t        j	                  d      d        |t        j	                  d      d        t         j                  d       y )N=
            [ZzDummy]
            enable = True
            zz-inr  zz-out)r  r-   r.   r   GetExtnNameForEventrr   )r2   r4   s     r   test_get_extn_name_for_eventz)IdleConfTest.test_get_extn_name_for_event  sZ      	 
8''/;
8''0$7	*r   c                     t         j                  d       | j                  t        j	                  d      ddgi       t         j                  d       y )Nr  r  <<z-in>>!<Control-Shift-KeyRelease-Insert>)r  r-   r.   r   GetExtensionKeysrr   r2   s    r   test_get_extension_keysz$IdleConfTest.test_get_extension_keys  sM      	 	229=<=>	@	*r   c                     t         j                  d       | j                  }t        j                  } | |d      i        dgdgd} | |d      |       t         j                  d       y )Nr  r   r  z!<Control-Shift-KeyRelease-Delete>)r  z	<<z-out>>r  )r  r-   r.   r   GetExtensionBindingsrr   )r2   r4   iGEBexpects       r   test_get_extension_bindingsz(IdleConfTest.test_get_extension_bindings  sl      	 ,,
4b!BC CDF
4	?F#	*r   c                    | 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        y )Nr   <<copy>>z<Control-Shift-Key-C>z<Control-Key-Insert>IDLE Classic Unixz<Alt-Key-w>z<Meta-Key-w>r   z<Control-Key-c>z<Control-Key-C>zIDLE Classic Mac<Command-Key-c>r   z
NOT EXISTS)r   r.   GetKeyBindingr   s      r   test_get_keybindingz IdleConfTest.test_get_keybinding  s    !
40*=$&<=	?
41:>N+	-
44jA 12	4
40*=@Q?RS
40*=@Q?RS 	4lJ7<
40,?Dr   c                     t         j                  }| j                         }dt         _        | j                  |j	                         |j                  |j                                      |t         _        y )Nr   )r   r   r   r.   GetCurrentKeySet	GetKeySetr   r   s      r   test_get_current_keysetz$IdleConfTest.test_get_current_keyset  sW    <<! $..0$..AQAQAS2TU (r   c                 d   | 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
       y )Nr   r   Foobar_cfgBindingsenableTruenewfooz<Key-F3>r   z
<<newfoo>>r   )r   r   rU   setr.   r(  r   s     r   test_get_keysetzIdleConfTest.test_get_keyset  s    ! 	%11(;%112FG%))(HfE%))*>*U(:;LI2Nr   c                 $   | j                         }| j                  |j                  d             | j                  |j                  d             | j                  |j                  d             | j                  |j                  d             y )Ncopycutzdel-word-rightz
not-exists)r   rV   IsCoreBindingrX   r   s     r   test_is_core_bindingz!IdleConfTest.test_is_core_binding  so    !**623**512**+;<=++L9:r   c                    | j                         }| j                  |j                  d      g        | j                  |j                  d      g        | j                  t        j
                        5  | j                  |j                  d      g        d d d        | j                  |j                         |j                  d      |j                  d      z          |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      g d       | j                  |j                         |j                  d      |j                  d      z          y # 1 sw Y   0xY w)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))IDLEz*C:/Programs/Python36/Lib/idlelib/help.htmlr:  )Pillowz(https://pillow.readthedocs.io/en/latest/r9  )Pythonzhttps://python.orgr7  )
r   r.   GetExtraHelpSourceListr   r   r   r8   GetAllExtraHelpSourcesListr   rW   r   s     r   test_extra_help_source_listz(IdleConfTest.test_extra_help_source_list  s    ! 	44Y?D44V<bAv667 	ET88?D	E++-''	2T5P5PQW5XX	Z
 	V&&{C9TUV&&{C9TUV&&{C9jkV&&{C9jk44V<A	B 	++-''	2T5P5PQW5XX	Z	E 	Es   2"GGc                 N   ddl m} ddlm} ddlm} | j                         } |d        |       }|j                          |j                   |dd|            }| j                  |j                  |d	d
      |d   |d   dk  rdn|d   |d   f       |j                          ~y )Nr   )requires)Tk)FontguiTkFixedFontT)rd   rp   rootr	   r   familysizer$   weight)test.supportrB  tkinterrC  tkinter.fontrD  r   withdrawactualr.   GetFontdestroy)r2   rB  rC  rD  r   rG  r   s          r   test_get_fontzIdleConfTest.test_get_font*  s    )%!tKK-4HILLv~6x[&	Q"AfIq{K	M
 	r   c                    | 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       y )Nz<<center-insert>>z<Control-l>r!  z<Control-c>z<Control-C>z<<history-next>>z<Alt-n>r   z<Control-Key-l>z<Control-Key-L>r   r#  r"  z<Alt-Key-n>z<Meta-Key-n>r   )r   r.   GetCoreKeysr   s      r   test_get_core_keyszIdleConfTest.test_get_core_keys=  s    !
412]OD
4j)M=+IJ
401I;?
4234GH01	3
4./
;>O=PQ
4/01CD>*	,
4./0BCN+	-r   N)F)&rG   rH   rI   classmethodr   r   r   r   unittestskipIfr   r   
startswithr   r   r   r   r   r   rY   r   r   r   r   r   r   r	  r  r  r  r  r%  r)  r0  r5  r@  rR  rU  r   r   r   rv   rv      s      % %. X__S\\,,U35ST) U), X__00779Z[) \),Z6B*>
$I8"Q$
5SP
( +$Y+++E"("O;Z6&-r   rv   c                   n    e Zd Z	 ej                  ZdZej                         Zd Zd Z	d Z
d Zd Zd Zy)	CurrentColorKeysTestr   c                    | 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       y )Nr   z<
            [Theme]
            default = True
            IDLE Newrd   non-existent)r.   	colorkeysdefault_themeusermainr-   rr   r  s    r   test_old_builtin_themez+CurrentColorKeysTest.test_old_builtin_themeX  s    0$2D2DE  	
 	0$2D2DE$.&!0*=$2&!0$2D2DE(r   c                 b   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       y )NzZ
            [Theme]
            default = True
            name2 = IDLE Dark
            r   z	IDLE Darkr]  rd   r^  name2)ra  r-   r.   r_  r`  rr   r  s    r   test_new_builtin_themez+CurrentColorKeysTest.test_new_builtin_themej  s      	
 	0+>$.&!0+>%3'"0$2D2DE(r   c                    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       y )Nz\
            [Theme]
            default = False
            name = Custom Dark
            r   z[Custom Dark]
a=bzCustom Darkr^  rd  )ra  r-   r.   r_  r`  userhighrr   r  s    r   test_user_override_themez-CurrentColorKeysTest.test_user_override_themez  s      	
 	0$2D2DE120-@%3'"0-@(.r   c                 ^   | j                  | j                  d      | j                         t        j	                  d       | j                  | j                  d      d       dt        d   d<   | j                  | j                  d      | j                         t        j                  d       y )Nr   z`
            [Keys]
            default = True
            name = IDLE Classic Unix
            r"  r^  rd   )r.   r_  r   ra  r-   rr   r  s    r   test_old_builtin_keysz*CurrentColorKeysTest.test_old_builtin_keys  s    /1B1BC  	
 	/1DE#1 /1B1BC'r   c                 b   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       y )Nz`
            [Keys]
            default = True
            name2 = IDLE Modern Unix
            r   r   r"  rd   r^  rd  )ra  r-   r.   r_  r   rr   r  s    r   test_new_builtin_keysz*CurrentColorKeysTest.test_new_builtin_keys  s      	
 	/1CD#6 /1CD$2!/1B1BC'r   c                    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       y )Nz[
            [Keys]
            default = False
            name = Custom Keys
            r   z[Custom Keys]
a=bzCustom Keysr^  rd  )ra  r-   r.   r_  r   userkeysrr   r  s    r   test_user_override_keysz,CurrentColorKeysTest.test_user_override_keys  s      	
 	/1B1BC12/?$2!/?'.r   N)rG   rH   rI   r   r   r_  r`  r   rb  re  rh  rj  rl  ro  r   r   r   r[  r[  M  sE     00I"M((*L)$) /"(( /r   r[  c                   |    e Zd Zi i i i dZd Zdddiidddiid	d
diii dZd Zd Zd Zd Z	d Z
d Zd Zd Zd Zy)ChangesTest)r	   r
   r   r   c                     | 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r2   r}  s     r   loadzChangesTest.load  sL    ,,667F;;@667F;r   rs  rt  ru  rv  rw  rx  ry  rz  r{  c                 6    t        j                         | _        y rM   )r   ConfigChangesr}  r  s    r   setUpzChangesTest.setUp  s    ++-r   c                 P    | j                  | j                  | j                         y rM   )r.   r}  emptyr  s    r   	test_initzChangesTest.test_init  s    tzz2r   c                     | j                         }| j                  || j                         |j                  dddd       | j                  || j                         y )Nr	   rs  rt  ru  )r  r.   loadedr~  r  s     r   test_add_optionzChangesTest.test_add_option  sI    ))+$++.667F;$++.r   c                    | 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       y )Nr	   r   what0
use-spacesr:  )r}  save_optionrV   rX   r.   ra  
has_optionrr   )r2   r  s     r   test_save_optionzChangesTest.test_save_option  s    ll..FHfcBCVXvsCD(+F3S9FHlCHI(+L93?FHlCHI,,X|DE)r   c                    | 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       y )Nrs  rt  ru  rv  rw  rx  ry  rz  r{  r	   )
r  rV   save_allr.   ra  rg  rn  r~  rX   rr   r  s     r   test_save_addedzChangesTest.test_save_added  s    ))+((*+&)'2F;&)'2F;&)'2F;667F;))+,'''r   c                     | j                   }|j                  dddd       |j                  dddd       |j                          | j	                  t
        j                  dd             | j                  t
        j                  dd             y )Nr	   r   r;  idledocELDIcodeldi)r}  r  r~  r  rX   ra  r  rV   r  s     r   test_save_helpzChangesTest.test_save_help  ss    ,,FKC6;	B,,[&AB++K@Ar   c                 D    | j                   }|j                  dddd       y )Nr	   r   r  r:  r|  r  s     r   test_save_defaultzChangesTest.test_save_default  s    ,,68\3?r   c                 h   | j                         }|j                  dd       | j                  || j                         dD ]c  \  }}t        |   j                  |dd       |j                  ||       | j                  t              5  ||   |    t        |   |    d d d        e y # 1 sw Y   pxY w)Nr	   fake))r	   rs  )r   ry  rd   value)r  delete_sectionr.   r  r   rW   r   KeyError)r2   r}  cfgtypesections       r   test_delete_sectionzChangesTest.test_delete_section   s    ))+vv.$++. D 	*GWG&&w@""7G4""8, * ) )* *	** *s   B((B1	c                 |    | j                         }|j                          | j                  || j                         y rM   )r  clearr.   r  r  s     r   
test_clearzChangesTest.test_clear  s*    ))+$**-r   N)rG   rH   rI   r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   rq  rq    sw    BrCE 01"Wf$56/0 F
.3/
*
(B@	*.r   rq  c                       e Zd Zd Zy)WarningTestc                 l   | j                   }t               t        _        t	               5 }t        j
                  dd       d d d         |t        j                  dh        |j                         d       t	               5 }t        j
                  dd       d d d         ||j                         d       t	               5 }t        j
                  dd       d d d         |t        j                  ddh        ||j                         d	       y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   RxY w)
Nwarningkey)r  r  zwarning
r   warn2yek)r  r  zwarn2
)r.   r/  r   _warnedr   r   getvalue)r2   Equalstderrs      r   	test_warnzWarningTest.test_warn  s       	+&LLE*	+fnn012foo0 	+&LLE*	+foo$ 	)&LL%(	)fnn0/BCfoo.	+ 	+	+ 	+	) 	)s#   DDD*DD'*D3N)rG   rH   rI   r  r   r   r   r  r    s    /r   r  rz      )	verbosity) r   r   r   rn   rl   rK  r   r   rW  r   idlelib.idle_test.mock_idler   r   r   r   r   rN   ra  rg  rn  r  r   r   TestCaser   rK   rv   r[  rq  r  rG   r	   r   r   r   <module>r     sR  
  
 	  2    , ??



6V66r: :76?";&";";B"? ?7;6V66r: :76?#<6#<#<R#@ @7< 
8C** 8CvP3X.. P3fV-8$$ V-rl/8,, l/^S.(## S.l/(## /$ zHMMA r   