python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_logging.cpython-312.opt-1.pyc

ΑeV
dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZddlmZddlmZddlmZddlmZddlm Z dd	lm!Z!dd
l"m#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddl(Z(ddl)Z)ddl*Z*ddl+m,Z,m-Z-ddl.m/Z/m0Z0dd
l1m2Z2m3Z3m4Z4m5Z5e)jl5ddl7m8Z8ddd	ddl9Z9ddl:Z:ddl;Z;	ddl=Z=Gdde(j|Z?Gdde?Z@Gdde?ZAdZBdZCdZDdZEdZFdZGdZHdZIdZJdZKeLeKeBdzZMeBd eCd!eDd"eEd#eFd$eGd%eHd&eId'eJd(eKd)i
ZNGd*d+ejZPGd,d-ejZQGd.d/e?ZRd0ZSGd1d2e?ZTGd3d4eUZVGd5d6ejZXGd7d8eUZYGd9d:e?ZZGd;d<e8jZ\Gd=d>eUZ]Gd?d@e]e,Z^GdAdBe]e4Z_GdCdDe]e2Z`eaedErGdFdGe_ZbGdHdIe`ZcejejGdJdKe?ZfGdLdMe?ZgGdNdOejZidPZjGdQdRe?ZkejejGdSdTe?Zle(jeaedEdUGdVdWelZnejejGdXdYe?Zoe(jeaedEdUGdZd[eoZpejejGd\d]e?Zqe(jeaedEdUGd^d_eqZre(jejd`GdadbeqZtejejGdcdde?ZuGdedfe?ZvGdgdhe?ZwGdidje?ZxddkZyGdldmZzdnZ{GdodpejZ|GdqdrejjZGdsdtejZduZddvZGdwdxe?ZGdydze?ZGd{d|e?ZGd}d~ejZGdde?ZejGdde?Zeaejdr)ddlZddlmZejGdde?ZejdZGddej"ZeZGddZGdde(j|eZGddej,ZGdde(j|ZGdde?ZGdde?ZGddZGddej8ZGdde?ZGdde?ZGdde?ZGdde(j|ZGdde(j|ZGdde?eZGdde?ZGddeZGddeZGddeZdZddddddeddffD]\ZZeefdZeedezee(je9dGdde?ZGdde(j|ZdZedk(re(jbyy#1swYxYw#e<$r
dxZ9xZ:Z;YwxYw#e<$rY
wxYw)zoTest harness for the logging module. Run all tests.

Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
N)assert_python_okassert_python_failure)support)	os_helper)
socket_helper)threading_helper)warnings_helper)asyncore)TestHandler)
HTTPServerBaseHTTPRequestHandler)urlparseparse_qs)ThreadingUDPServerDatagramRequestHandlerThreadingTCPServerStreamRequestHandler)smtpdc6eZdZdZdZdZdZdZdZd
dZ	d	Z
y)BaseTestzBase class for logging tests.z&%(name)s -> %(levelname)s: %(message)sz^([\w.]+) -> (\w+): (\d+)$rctj|_tjj
j}tj	tjj|_
tjdd|_|jx|_
}tjj|_tj j|_ix|_}|D]}t'||dd||<	tj(tjd|_tjd|_tjd|_|j.j1|_t5j6|_|j.j;tj<tj>|j8|_ tjB|jD|_#|j@jI|jF|j*jKr;|j*jL|j.jLz}tOd|z|j,jKr;|j,jL|j.jLz}tOd|z|j.jQ|j@|jS|j*jK|jS|j,jKy#tj(wxYw)zxSetup the default logging stream to an internal StringIO instance,
        so that we can examine log output as we want.Ndisabledu«×»uĿÖGzUnexpected handlers: %s)*rthreading_setup_threading_keylogging	getLoggermanager
loggerDict_acquireLock	_handlerscopysaved_handlers_handlerListsaved_handler_list
saved_loggers_nameToLevelsaved_name_to_level_levelToNamesaved_level_to_name
logger_statesgetattr_releaseLocklogger1logger2root_loggergetEffectiveLeveloriginal_logging_levelioStringIOstreamsetLevelDEBUG
StreamHandler	root_hdlr	Formatter
log_formatroot_formattersetFormatterhasHandlershandlersAssertionError
addHandler
assertTrue)selflogger_dictr'r,namehlists      E/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_logging.pysetUpzBaseTest.setUpWs/>>@'')11<<	#")"3"3"8"8":D&-&:&:1&=D#1<1A1A1CCD'.';';'@'@'BD$'.';';'@'@'BD$133D%
@&-mD.A.8$'@
d#
@
  "((8(()=>",,R0&*&6&6&H&H&J#kkm!!'--0 ..t{{;%//@##D$7$78<<##%LL))D,<,<,E,EEE !:U!BCC<<##%LL))D,<,<,E,EEE !:U!BCC##DNN300230023-
  "s
B;M%%M;c|jj|jj|j|jj
r[|jj
d}|jj||j|jj
r[|jj
|jtj	tjjtjj|jtjjtjj|jtj jtj j|j"|j$tj&ddtj(j*}d|_|j.}|j|j|j0|j2}|j2D]}||	|||j0|_!	tj6|j9t;j<|j>y#tj6wxYw)zJRemove our logging stream, and restore the original logging
        level.rN) r6closer1
removeHandlerr:r@r7r3rr!r*clearupdater+r(r)r"r$r&r%rrdisabler r'r,rr.
doCleanupsrthreading_cleanupr)rDhrr r,rFs      rHtearDownzBaseTest.tearDowns
	
&&t~~6''  ))!,A**1-
GGI''	
!!$"="=>	#  &&(  ''(@(@A  &&(  ''(@(@A##%$$T%8%89&*&=&=G  #'')11GGO ++Jd001 ..M**
L &28Ed8KD&&t,5
L
  "**D,?,?@
  "s+E.J5J55KNc|xs|j}tj|xs|j}|j	j}|j
t|t|t||D]U\}}|j|}|s|jd|z|j
t|j|W|j}|r|jd|zyy)zMatch the collected log lines against the regular expression
        self.expected_log_pat, and compare the extracted group values to
        the expected_values list of tuples.z*Log line does not match expected pattern:
z'Remaining output at end of log stream:
N)r6recompileexpected_log_patgetvalue
splitlinesassertEquallenzipsearchfailtuplegroupsread)	rDexpected_valuesr6patactual_linesactualexpectedmatchss	         rHassert_log_lineszBaseTest.assert_log_liness&4;;jj5 5 56(335\*C,@A #L/ B	>FHJJv&E		G"#$U5<<>2H=	>
KKMII@1DE
cJ|xjdz
c_d|jzS)zMGenerate a message consisting solely of an auto-incrementing
        integer.rz%d)message_numrDs rHnext_messagezBaseTest.next_messages&	
Ad&&&&rjNN)__name__
__module____qualname____doc__r<rWrlrIrSrirnrjrHrrOs-'9J4K(4T ADF$'rjrc:eZdZdZdZdZdZdZdZdZ	dZ
y	)
BuiltinLevelsTestz*Test builtin levels and their inheritance.c|j}tjd}|jtjtj
tjdi}|jtjtjd}|jtj|jtj||j||jtj||j||j||j||jtj||j||j||j||j||j||j||j||j||jgdy)NERRINFDEB))rxCRITICAL1)rxERROR2)ryr{3)ryr}4)ryWARNING5)ryINFO6)rzr{7)rzr}8)rzr9)rzr10)rzr811)rnrrr7r}
LoggerAdapterrr8logr{errorwarninginfodebugri)rDmrxryrzs     rH	test_flatzBuiltinLevelsTest.test_flatsr&W]]###G$5$5e$<bAW\\"&W]]#	  !#&		!#  !#&		!#AC
  !#&		!#AC
		!#	AC
		!#		!#
	rjc|j}tjd}|jtjtjd}|jtj
|j
tj||j||j||j||j||jddgy)NryINF.ERR)rr{r|)rr}r~
rnrrr7rr}rr{rrrrri)rDrryINF_ERRs    rHtest_nested_explicitz&BuiltinLevelsTest.test_nested_explicits&W\\"$$Y/'	G$$ac*

ac	QS

ac(%
	rjc|j}tjd}|jtjtjd}|jtj
tjd}tjd}tjd}|j
tj||j||j||j||j
tj||j||j||j||j||j||jgdy)Nryr	INF.UNDEF
INF.ERR.UNDEFUNDEF))rr{r|)rr}r~)rrr)rrr)rr{r)rr}rr)rDrryr	INF_UNDEF
INF_ERR_UNDEFrs       rHtest_nested_inheritedz'BuiltinLevelsTest.test_nested_inheriteds>&W\\"$$Y/'%%k2	))/:
!!'*	

g&&,!#qs'**AC0AC 	ac"13AC 
	rjcB|j}tjd}tjd}tjd}|jtj|jtj||j||jtj||j||j||j||jgdy)NryINF.BADPARENT.UNDEF
INF.BADPARENT))rr{r|)rrr~)rr{r)rrr)
rnrrr7rrFATALrrri)rDrry
GRANDCHILDCHILDs     rHtest_nested_with_virtual_parentz1BuiltinLevelsTest.test_nested_with_virtual_parent(s&&&'<=
!!/2W\\"	w}}ac*
		'--%

13	
AC
	rjc|jtjdtj|jtjtjdy)z&See issue #22386 for more information.rN)rZrgetLevelNamerrms rHtest_regression_22386z'BuiltinLevelsTest.test_regression_22386Bs@--f5w||D--gll;VDrjcntjd}|j|tjy)Nr)rrrZr)rDfatals  rHtest_issue27935z!BuiltinLevelsTest.test_issue27935Gs&$$W-

.rjctjtjd|jtjtjd|j	tj
tjd|j	tj
tjd|j	tj
dtjy)z&See issue #29220 for more information.rrNOTSETN)raddLevelNamer
addCleanuprZrrrms rHtest_regression_29220z'BuiltinLevelsTest.test_regression_29220KsW\\2.,,gllFC--gll;R@--gnn=xH--h7HrjN)rprqrrrsrrrrrrrrtrjrHrvrvs,4-^.!F4E
/Irjrvc"eZdZdZdZdZdZy)BasicFilterTestzTest the bundled Filter class.ctjd}|jjd}	|j	|tj
d}tj
d}tj
d}tj
d}|j
|j|j
|j|j
|j|j
|j|jddg|j|y#|j|wxYw)N	spam.eggsrspamspam.eggs.fishspam.bakedbeansrrr~rrr)
rFilterr1r@	addFilterrrrnriremoveFilter)rDfilter_handlerr	spam_eggsspam_eggs_fishspam_bakedbeanss       rHtest_filterzBasicFilterTest.test_filterWs
..-""++A.	*g&$$V,D))+6I$../?@N%//0ABOIId'')*NN4,,./ 1 1 34  !2!2!45!!*/#


  )G  )sC4D66E	ctd}|jjd}	|j|tjd}tjd}tjd}tjd}|j|j
|j|j
|j|j
|j|j
|jddg|j|y#|j|wxYw)	Ncj|jjd}dj|dd}|dk(S)N.r)rFsplitjoin)recordpartsprefixs   rH
filterfuncz8BasicFilterTest.test_callable_filter.<locals>.filterfuncss5KK%%c*EXXeBQi(F[((rjrrrrrrr)	r1r@rrrrrnrir)rDrrrrrrs       rHtest_callable_filterz$BasicFilterTest.test_callable_filteros	)
""++A.	-j)$$V,D))+6I$../?@N%//0ABOIId'')*NN4,,./ 1 1 34  !2!2!45!!*/#


  ,G  ,sC4D$$D7ctj}tjddi}|j|j	|y)NrFr)rr
makeLogRecordrCfilter)rDfrs   rHtest_empty_filterz!BasicFilterTest.test_empty_filters7NN!!6;"78$rjN)rprqrrrsrrrrtrjrHrrSs(*0-:%rjrxwvutsrqpoSilentTaciturnTerseEffusiveSociableVerbose	Talkative	Garrulous
ChatterboxBoringceZdZdZdZy)GarrulousFilterz)A filter which blocks garrulous messages.c(|jtk7SN)levelno	GARRULOUSrDrs  rHrzGarrulousFilter.filters~~**rjNrprqrrrsrrtrjrHrrs
3+rjrceZdZdZdZy)VerySpecificFilterz5A filter which blocks sociable and taciturn messages.c2|jttfvSr)rSOCIABLETACITURNrs  rHrzVerySpecificFilter.filters~~h%999rjNrrtrjrHrrs
?:rjrc>eZdZdZdZdZdZdZdZdZ	dZ
d	Zy
)CustomLevelsAndFiltersTestz@Test various filtering possibilities with custom logging levels.^[\w.]+ -> (\w+): (\d+)$ctj|tjD]\}}t	j
||yr)rrImy_logging_levelsitemsrr)rDkvs   rHrIz CustomLevelsAndFiltersTest.setUps:t%++-	'DAq  A&	'rjcZtD]"}|j||j$yr)LEVEL_RANGErrn)rDloggerlvls   rHlog_at_all_levelsz,CustomLevelsAndFiltersTest.log_at_all_levelss(	1CJJsD--/0	1rjcldtjfd}tjd}tjd}tj}tj}tj
|}tj
|}|j
||j||j||jd|j|j|j|jd|j|jdy)Nrc>tj|}d|_|S)Nznew message!)r#msg)rs rHreplace_messagezWCustomLevelsAndFiltersTest.test_handler_filter_replaces_record.<locals>.replace_messagesYYv&F'FJMrjparentzparent.childzoriginal messagezoriginal message
z
new message!
)r	LogRecordrr4r5r9rrBrflushrZrX)rDrrchildstream_1stream_2	handler_1	handler_2s        rH#test_handler_filter_replaces_recordz>CustomLevelsAndFiltersTest.test_handler_filter_replaces_records	G$5$5	""8,!!.1;;=;;=))(3	))(3	O,)$
#

%&**,.BC**,.>?rjchtGfddtj}tjd}|j	tj
|j
||j
||jd|jdty)Nc2eZdZdejffdZy)WCustomLevelsAndFiltersTest.test_logging_filter_replaces_record.<locals>.RecordingFilterrcbjt|tj|Sr)addidr#)rDrrecordss  rHrz^CustomLevelsAndFiltersTest.test_logging_filter_replaces_record.<locals>.RecordingFilter.filters"BvJ'yy((rjN)rprqrrrrr)rsrHRecordingFilterrs
)W%6%6
)rjrrrr)
setrrrr7rrrrZr[)rDrrrs   @rH#test_logging_filter_replaces_recordz>CustomLevelsAndFiltersTest.test_logging_filter_replaces_records~%	)gnn	)
""8,%*+*+ECL)rjc|jjt|j|j|j	gdy)N)rrrrrrrrrrrr)r1r7VERBOSErrirms rHtest_logger_filterz-CustomLevelsAndFiltersTest.test_logger_filters=!!'*t//0
	rjc|jjdjt	|j	|j|jgd|jjdjtjy#|jjdjtjwxYw)Nr)rrrrr)r1r@r7rrrirrrms rHtest_handler_filterz.CustomLevelsAndFiltersTest.test_handler_filters!!!$--h7	B""4#3#34!!#

%%a(11'..AD%%a(11'..As.B8Cc@|jjd}d}t}|j|	|j	|jgd}|j|t
}|jj||j	|j|j|gdz|r|jj||j|y#|r|jj||j|wxYw)Nr)	)rr|)rr~)rrrrrrrr))rr)r12)r14)r15)r17)r18)r20)r1r@rrrrirr)rDrspecific_filtergarrfirst_liness     rHtest_specific_filtersz0CustomLevelsAndFiltersTest.test_specific_filters!s""++A. $!	'""4#3#34K
!!+.02O&&7""4#3#34!!+
1

#


  --o>  &  --o>  &sBC--0DN)rprqrrrsrWrIrr
rr r"r-rtrjrHrrs2J3'
1@8*"B ('rjrc`tj|i|\}}tj||Sr)tempfilemkstemposrK)argskwargsfdfns    rHmake_temp_filer6Ls+


t
.v
.FBHHRL
IrjcReZdZdZdZdZejejdk(deje
jdeje
jddZe
j ejd	Zy
)HandlerTestctj}d|_|j|jdd|_|j|jd|j	t
|jdy)Ngenericanothergeneric)rHandlerrFrZassertRaisesNotImplementedErroremitrDrRs  rH	test_namezHandlerTest.test_nameSs\OO+!!12-qvvt<rjctjdvrdD]}t}|stj|t
jj|dd}|r|j|j}}|j|d|j|dtjddi}|j|tj||jtjj||j||j!tjj|n8|j|jd|j|jd|j#|s|tj|tjd	k(rd
}nd}	t
jj%|}|j|j&|j(|j!|j*|j#dD]j}|d
k(r2|j/t0t
jj2dd|:t
jj3dd|}|j#lt
jj5d}tji}|j!|j7||j#t
jj5d}|j|j7||j#y#t,$rY/wxYw)Nlinuxdarwin)TFutf-8TencodingdelayrTestrEz/var/run/syslogz/dev/log)GETPOSTPUTrN	localhostz/logrr)sysplatformr6r1unlinkrr@WatchedFileHandlerdevinorZrhandleassertFalsepathexistsrCrK
SysLogHandlerfacilityLOG_USER
unixsocketOSErrorr=
ValueErrorHTTPHandlerBufferingHandlershouldFlush)	rDexistingr5rRrTrUrsocknamemethods	         rHtest_builtin_handlersz!HandlerTest.test_builtin_handlers[s<<..)
"#%IIbM$$77WTX7Y uuaeeC$$S"-$$S"---ufo>AHHQKIIbM$$RWW^^B%78HHQKOOBGGNN2$67$$QUUB/$$QUUB/	IIbM-
".||x',%
$$228<  QZZ8-	-	F!!*g.>.>.J.J"-vv?$$00ffM	
	
--a0!!"%

a()		--a0q)*		

sA0M	M#"M#c<t}tj|tj|}t
j|dfft
jj|dfft
jj|dfff}tjdvr"|t
jj|dfffz
}|D]`\}}||ddi}|jtjj||j!tj|by)zs
        Test that Path objects are accepted as filename arguments to handlers.

        See Issue #27493.
        warRrCrHrFN)r6r1rRpathlibPathrFileHandlerr@RotatingFileHandlerTimedRotatingFileHandlerrPrQrSrCrXrYrK)rDr5pfncasesclsr2rRs       rHtest_path_objectszHandlerTest.test_path_objectss

		"
ll2((3*5%%99C:F%%>>c
K
<<..w''::S#JGIIE	ICT,G,AOOBGGNN2./
GGIIIbM		rjntz/WatchedFileHandler not appropriate for Windows.z'Emscripten cannot fstat unlinked files.walltimec	fd}d}d}d_d_dD]F}tdd}tj|||f}d|_|j
tjj|d|	}tjd
}|j|	t|D]Y}	tjdtjdd
i}
	tj_|j!|
[	|j'|j)t*j,j/|s2t+j0|Iy#t"$r't%djdjwxYw#|j'|j)t*j,j/|rt+j0|wwxYw)Nct|D]]}	tj|tj_tjdtjddz_y#t
$rY:wxYw)NgMbp?r)	ranger1rRtime
deletion_timer^sleeprandomrandint)fnametries_rDs   rHremove_loopz*HandlerTest.test_race.<locals>.remove_loopsg5\
9IIe$)-D&

56>>!Q#778

9s.A..	A:9A:iFT.logztest_logging-3-targetr2TrFrGz'%(asctime)s: %(levelname)s: %(message)s{Gzt?rtestingzDeleted at z, opened at )handle_timerzr6	threadingThreaddaemonstartrr@rSr;r>rxryr{rrV	ExceptionprintrrKr1rXrYrR)rDr	del_count	log_countrIr5removerrRrrrs`          rH	test_racezHandlerTest.test_races	9		!"	"E(9:B&&kYPG!GNMMO  33BPU3VA!!"KLA
NN1
"y)
AJJu%--ui.ABA+/99;(
	77>>"%IIbM1	"%040B0B040@0@BC		77>>"%IIbM&s%$:F*E&	F&0FFAG0cHGddtj}|jttjd||jjjjd_	|jttjd|jttjdtjd}|j|jtjt!j"t!j"fd}t!j$|d	}|j'j)t+j,}|dk(r(	|j/d
t+j0dy
|j/dj3|j5t7j8|dy
#t+j0dwxYw)z>Ensure child logging locks are not held; bpo-6721 & bpo-36533.c$eZdZfdZdZxZS)AHandlerTest.test_post_fork_child_no_deadlock.<locals>._OurHandlercpt|tjt	ddd|_y)Nz	/dev/nullwtrFrHr6)super__init__rr9opensub_handlerrD	__class__s rHrzJHandlerTest.test_post_fork_child_no_deadlock.<locals>._OurHandler.__init__s. "#*#8#8TGD$F rjc|jj	|jj||jjy#|jjwxYwr)racquirer?releasers  rHr?zFHandlerTest.test_post_fork_child_no_deadlock.<locals>._OurHandler.emitsR  ((*/$$))&1$$,,.D$$,,.sAA.rprqrrrr?
__classcell__rs@rH_OurHandlerrs
F

/rjrrz*because we need at least one for this testr test_post_fork_child_no_deadlockc:tj	j	jj	dj	tjy#jwxYw#tjwxYw)N?)rr!rrwaitrr.)+fork_happened__release_locks_and_end_threadlocks_held__ready_to_forkrefed_hsrHlock_holder_thread_fnzKHandlerTest.test_post_fork_child_no_deadlock.<locals>.lock_holder_thread_fnsq  "
'!&-113@DDSIOO%$$&OO%$$&s"B!A/	B/BBBz,test_post_fork_child_no_deadlock lock holder)rrFz#Child process did not deadlock. \o/z&Parent process returned from fork. \o/)exitcodeN)rr<rZr[r"rrr6rKrF
assertGreater_at_fork_reinit_lock_weaksetrrBr7r8rEventrrrr1forkr_exitrrrwait_process)	rDrtest_loggerrlock_holder_threadpidrrrs	      @@@rHrz,HandlerTest.test_post_fork_child_no_deadlocks	/'//	/	
W../3-++22889C3w001153wCCDaH''(JKw'W]]+$-OO$5!6?oo6G3	'2'--,CE	  "!&&(ggi!8
  !GH
FG7;;=##%  q1sH

H!N)rprqrrrArfrrunittestskipIfr1rFr
is_emscriptenrrequires_working_threadingrequires_resourcer
requires_forkrrtrjrHr8r8Rs=3j,X__RWW_&WXX__H1002Wz*)"+3Y)"^W0002H23H2rjr8ceZdZdZy)	BadStreamctd)Ndeliberate mistake)RuntimeError)rDdatas  rHwritezBadStream.write)s/00rjN)rprqrrrrtrjrHrr(s1rjrceZdZdZy)TestStreamHandlerc||_yr)error_recordrs  rHhandleErrorzTestStreamHandler.handleError-s
"rjN)rprqrrrrtrjrHrr,s#rjrc(eZdZejZdZy)StreamWithIntNamerN)rprqrrrrlevelrFrtrjrHrr0sNNEDrjrceZdZdZdZdZy)StreamHandlerTestctt}tji}tj}	|j||j
|j|tjt}tj5}|j|d}|j||jddddt_tj5}|j||jd|jddd|t_y#1swYnxYw#1swY!xYw#|t_wxYw)Nz"
RuntimeError: deliberate mistake
Fr)rrrrraiseExceptionsrVassertIsrr9rcaptured_stderrassertInrXrZ)rDrRr	old_raisestderrrs      rHtest_error_handlingz%StreamHandlerTest.test_error_handling5s	ik*!!"%++		0
HHQKMM!..!,%%ik2A((*
6f<

c6??#45
6
',G#((*
8f  V__%67
8'0G#
6
6
8
8'0G#s<AE4D9'E32E%E9E>EE
E
Ec@tj}tj}|j	|}|j|tj|j	|}|j|||j	|}|j|y)z3
        Test setting the handler's stream
        N)	rr9r4r5	setStreamrrPrassertIsNone)rDrRr6oldres     rHtest_stream_settingz%StreamHandlerTest.test_stream_settingKsu
!!#kk&!

c3::&S!

ff%S!&!rjcttjt}|jt	|dy)Nz<StreamHandler 2 (NOTSET)>)rr9rrZreprr@s  rH'test_can_represent_stream_with_int_namez9StreamHandlerTest.test_can_represent_stream_with_int_nameYs+!!"3"56a">?rjN)rprqrrrrrrtrjrHrr4s0,"@rjrc.eZdZdZdZdZdZdZdZy)TestSMTPServera
    This class implements a test SMTP server.

    :param addr: A (host, port) tuple which the server listens on.
                 You can specify a port value of zero: the server's
                 *port* attribute will hold the actual port number
                 used, which can be used in client connections.
    :param handler: A callable which will be called to process
                    incoming messages. The handler will be passed
                    the client address tuple, who the message is from,
                    a list of recipients and the message data.
    :param poll_interval: The interval, in seconds, used in the underlying
                          :func:`select` or :func:`poll` call by
                          :func:`asyncore.loop`.
    :param sockmap: A dictionary which will be used to hold
                    :class:`asyncore.dispatcher` instances used by
                    :func:`asyncore.loop`. This avoids changing the
                    :mod:`asyncore` module's global state.
    ctjj||d|d|jj	d|_||_d|_d|_||_	y)NT)mapdecode_datarF)
r
SMTPServerrsocketgetsocknameport_handler_thread_quit
poll_interval)rDaddrrrsockmaps     rHrzTestSMTPServer.__init__us\
!!$d.2	"	4KK++-a0	

*rjc,|j||||y)aI
        Delegates to the handler passed in to the server's constructor.

        Typically, this will be a test case method.
        :param peer: The client (host, port) tuple.
        :param mailfrom: The address of the sender.
        :param rcpttos: The addresses of the recipients.
        :param data: The message.
        N)r)rDpeermailfromrcpttosrs     rHprocess_messagezTestSMTPServer.process_message~s	


dHgt4rjctj|j|jfx|_}d|_|j
y)zG
        Start the server running on a separate daemon thread.
        rTNrr
serve_foreverrrrrrDts  rHrzTestSMTPServer.startC%++43E3E262D2D1FH	Hq		rjc||js0tj||jd|js/yy)a*
        Run the :mod:`asyncore` loop until normal termination
        conditions arise.
        :param poll_interval: The interval, in seconds, used in the underlying
                              :func:`select` or :func:`poll` call by
                              :func:`asyncore.loop`.
        r)rcountN)rr
loop_map)rDrs  rHrzTestSMTPServer.serve_forevers(**MM-TYYa@**rjcd|_tj|jd|_|j	tj|jdy)zr
        Stop the thread by closing the server instance.
        Wait for the server thread to terminate.
        TN)r
ignore_all)rrjoin_threadrrKr
	close_allrrms rHstopzTestSMTPServer.stopsA

$$T\\2

tyyT:rjN)	rprqrrrsrrrrrrtrjrHrr`s!(+
5	A	;rjrc4eZdZdZdZdZfdZdZxZS)ControlMixina

    This mixin is used to start a server on a separate thread, and
    shut it down programmatically. Request handling is simplified - instead
    of needing to derive a suitable RequestHandler subclass, you just
    provide a callable which will be passed each received request to be
    processed.

    :param handler: A handler callable which will be called with a
                    single parameter - the request - in order to
                    process the request. This handler is called on the
                    server thread, effectively meaning that requests are
                    processed serially. While not quite web scale ;-),
                    this should be fine for testing applications.
    :param poll_interval: The polling interval in seconds.
    c`d|_||_||_tj|_yr)rrrrrready)rDrrs   rHrzControlMixin.__init__s&*
__&
rjctj|j|jfx|_}d|_|j
y)zI
        Create a daemon thread to run the server, and start it.
        rTNrrs  rHrzControlMixin.startrrjc`|jjtt||y)z^
        Run the server. Set the ready flag before entering the
        service loop.
        N)rrrrr)rDrrs  rHrzControlMixin.serve_forevers"
	


lD/
>rjc|j|j&tj|jd|_|j	|j
j
y)zK
        Tell the server thread to stop, and wait for it to do so.
        N)shutdownrrrserver_closerrMrms rHrzControlMixin.stopsL	


<<#((6DL

rj)	rprqrrrsrrrrrrs@rHrrs'?	rjrc"eZdZdZ		ddZdZy)TestHTTPServera
    An HTTP server which is controllable using :class:`ControlMixin`.

    :param addr: A tuple with the IP address and port to listen on.
    :param handler: A handler callable which will be called with a
                    single parameter - the request - in order to
                    process the request.
    :param poll_interval: The polling interval in seconds.
    :param log: Pass ``True`` to enable log messages.
    NcGfddttj||tj|||||_y)Nc2eZdZddZdZfdZxZS)=TestHTTPServer.__init__.<locals>.DelegatingHTTPRequestHandlercR|jdr|jSt|)Ndo_)
startswithprocess_requestAttributeError)rDrFdefaults   rH__getattr__zITestHTTPServer.__init__.<locals>.DelegatingHTTPRequestHandler.__getattr__s%??5)///$T**rjc:|jj|yrserverrrms rHrzMTestHTTPServer.__init__.<locals>.DelegatingHTTPRequestHandler.process_request$$T*rjc,rt||g|yyr)rlog_message)rDformatr2DelegatingHTTPRequestHandlerrrs   rHrzITestHTTPServer.__init__.<locals>.DelegatingHTTPRequestHandler.log_messages)6,,2;59;rjr)rprqrrrrrr)rrrs@rHrrs
+

+
;
;rjr)r
rrrsslctx)rDrrrrr rs    ` @rHrzTestHTTPServer.__init__s>	;+A	;	D$(DEdG];rjc	|jj\}}|jr|jj|d}||fS#t$r(}t
jjd|zd}~wwxYw)NT)server_sidezGot an error:
%s
)racceptr wrap_socketr^rPrr)rDsockres    rHget_requestzTestHTTPServer.get_requestsv	++-JD${{{{..t.F
Tz		JJ2Q67	sAA	A=#A88A=)rFN)rprqrrrsrr'rtrjrHr
r
s	58#'&	rjr
c2eZdZdZdZ		ddZfdZxZS)
TestTCPServera
    A TCP server which is controllable using :class:`ControlMixin`.

    :param addr: A tuple with the IP address and port to listen on.
    :param handler: A handler callable which will be called with a single
                    parameter - the request - in order to process the request.
    :param poll_interval: The polling interval in seconds.
    :bind_and_activate: If True (the default), binds the server and starts it
                        listening. If False, you need to call
                        :meth:`server_bind` and :meth:`server_activate` at
                        some later time before calling :meth:`start`, so that
                        the server will set up the socket and listen on it.
    TcGddt}tj||||tj|||y)NceZdZdZy);TestTCPServer.__init__.<locals>.DelegatingTCPRequestHandlerc:|jj|yrrrms rHrVzBTestTCPServer.__init__.<locals>.DelegatingTCPRequestHandler.handlerrjN)rprqrrrVrtrjrHDelegatingTCPRequestHandlerr,s
+rjr.)rrrr)rDrrrbind_and_activater.s      rHrzTestTCPServer.__init__s;	+*>	+	##D$0K$5	7dG];rjcntt||jj	d|_yNr)rr)server_bindrrrrs rHr2zTestTCPServer.server_bind )
mT.0KK++-a0	rjrT)rprqrrrsallow_reuse_addressrr2rrs@rHr)r)s%47#'<11rjr)c8eZdZdZ		ddZfdZfdZxZS)
TestUDPServera0
    A UDP server which is controllable using :class:`ControlMixin`.

    :param addr: A tuple with the IP address and port to listen on.
    :param handler: A handler callable which will be called with a
                    single parameter - the request - in order to
                    process the request.
    :param poll_interval: The polling interval for shutdown requests,
                          in seconds.
    :bind_and_activate: If True (the default), binds the server and
                        starts it listening. If False, you need to
                        call :meth:`server_bind` and
                        :meth:`server_activate` at some later time
                        before calling :meth:`start`, so that the server will
                        set up the socket and listen on it.
    cGfddttj|||tj|||d|_y)Nc(eZdZdZfdZxZS);TestUDPServer.__init__.<locals>.DelegatingUDPRequestHandlerc:|jj|yrrrms rHrVzBTestUDPServer.__init__.<locals>.DelegatingUDPRequestHandler.handle9rrjc|jj}|r	t|yy#t$r|j
jsYywxYwr)wfilerXrfinishr^r_closed)rDrDelegatingUDPRequestHandlerrs  rHr>zBTestUDPServer.__init__.<locals>.DelegatingUDPRequestHandler.finish<sVzz**,"94GI#"#{{22! 3"s/ AA)rprqrrrVr>r)rr@s@rHr@r:7s
+
"
"rjr@F)rrrrr?)rDrrrr/r@s     @rHrzTestUDPServer.__init__5sE	"*@	"	##D$$?$5	7	dG];rjcntt||jj	d|_yr1)rr7r2rrrrs rHr2zTestUDPServer.server_bindKr3rjc8tt|d|_y)NT)rr7rr?rs rHrzTestUDPServer.server_closeOs
mT/1rjr4)rprqrrrsrr2rrrs@rHr7r7$s$ 58#',1rjr7AF_UNIXc$eZdZejZy)TestUnixStreamServerNrprqrrrrCaddress_familyrtrjrHrErETrjrEc$eZdZejZy)TestUnixDatagramServerNrFrtrjrHrJrJWrHrjrJc0eZdZejZdZdZy)SMTPHandlerTestci}ttjdf|jd|}|j	tj|j
f}tjj|ddd|j}|j|jdgg|_t
jddi}tj|_|j#||j j%|j|j'|j)|j j+|jt-|jd	|jd\}}}}	|j|d|j|dg|j/d
|	|j)|	j1d|j3y)NrMbP?meyouLog)timeoutru	Hello ✓rz
Subject: Log
u

Hello ✓)rrHOSTrrrrr@SMTPHandlerTIMEOUTrZtoaddrsmessagesrrrhandledrVrrrCis_setr[rendswithrK)
rDrrrrRrrrrrs
          rH
test_basiczSMTPHandlerTest.test_basicbsu!3!3Q 79M9Mu ')""FKK0((tUE15
)
?UG,
!!5."9: (	$,,'
++-.T]]+Q/(,

a(8%h4(5'*

($/

&89:		rjcn|jj||jjyr)rWappendrXr)rDr2s  rHrzSMTPHandlerTest.process_messagezs$

T"rjN)rprqrrrLONG_TIMEOUTrUr[rrtrjrHrLrL\s""G0rjrLc`eZdZdZdZdZdZdZdZdZ	e
jdZy	)
MemoryHandlerTestzTests for the MemoryHandler.rcJtj|tjj	dtj
|j|_tjd|_	d|j_
|jj|jy)N
memr)rrIrr@
MemoryHandlerrr:mem_hdlrr
mem_logger	propagaterBrms rHrIzMemoryHandlerTest.setUpsjt((66r7??7;~~G
!++E2$%!""4==1rjcb|jjtj|yr)rerKrrSrms rHrSzMemoryHandlerTest.tearDown 

$rjc	R|jj|j|jg|jj	|j|jg|jj|jgd}|j|dD]}t
dD]+}|jj|j-|j||jj|j|t
||dzDcgc]}dt|fc}z}|j||jj|j|j|ycc}w)N)r8r|rr~)rr)rw	rbr8)rfrrnrirrrxstr)rDlinesnis    rH
test_flushzMemoryHandlerTest.test_flushsX	
d//12b!T..01b! 1 1 34

	
e$	)A1X
;%%d&7&7&9:
;!!%(
OO!!$"3"3"56aR8HI1gs1v.IIE!!%(	)	
d//12e$	Js=F$c|jj|j|jg|jj	|j|jg|jj|j|jjddg}|j|tjjdtj|jd|_|jj|j|jj|j|j||jj	|j|j||jj|j|jj|j|y)zO
        Test that the flush-on-close configuration works as expected.
        rkrlrbFN)rfrrnrirrLrerKrr@rdrr:rBrDrps  rHtest_flush_on_closez%MemoryHandlerTest.test_flush_on_closesa	
d//12b!T..01b!%%dmm4


	
e$((66r7??7;~~7<>
	
""4==1d//12e$T..01e$%%dmm4

e$rjc|jj|j|jg|jj	|j|jgtjt
jj|jgddg}|j|t
jjdt
j|jd|_	|jj|j|jj|j|j||jj	|j|j|tjt
jj|jg|j|y)zi
        Test that the flush-on-close configuration is respected by the
        shutdown method.
        handlerListrkrlrbFN)rfrrnrirrr
weakrefrefrer@rdrr:rBrus  rHtest_shutdown_flush_on_closez.MemoryHandlerTest.test_shutdown_flush_on_closes]
	
d//12b!T..01b!goo&9&9$--&H%IJ
	
e$((66r7??7;~~7<>
	
""4==1d//12e$T..01e$goo&9&9$--&H%IJe$rjcGdd}||j}	|jj|tdD]M}tjd|j
j
d|j
jdO	|jD]}tj|y#|jD]}tj|wxYw)NceZdZdZdZdZy)ZMemoryHandlerTest.test_race_between_set_target_and_flush.<locals>.MockRaceConditionHandlerc ||_g|_yr)rethreads)rDres  rHrzcMemoryHandlerTest.test_race_between_set_target_and_flush.<locals>.MockRaceConditionHandler.__init__s (
!rjc:|jjdyr)re	setTargetrms rHremoveTargetzgMemoryHandlerTest.test_race_between_set_target_and_flush.<locals>.MockRaceConditionHandler.removeTargets

''-rjctj|j}|jj	||jy)N)r)rrrrr]r)rDrthreads   rHrVzaMemoryHandlerTest.test_race_between_set_target_and_flush.<locals>.MockRaceConditionHandler.handles3"))1B1BC##F+rjN)rprqrrrrrVrtrjrHMockRaceConditionHandlerrs
"
.
rjrrbrznot flushedflushed)rerrxryr{rfrrrrr)rDrrrrs     rH&test_race_between_set_target_and_flushz8MemoryHandlerTest.test_race_between_set_target_and_flushs		*$--8		5MM##F+2Y
3

5!$$]3''	2
3
!..
5 ,,V4
5&..
5 ,,V4
5sA6B<<(C$N)
rprqrrrsrWrIrSrsrvr|rrrrtrjrHr`r`~sF&32 %8%<%:1002535rjr`ceZdZdZdZy)ExceptionFormatterzA special exception formatter.c&d|djzS)Nz
Got a [%s]r)rp)rDeis  rHformatExceptionz"ExceptionFormatter.formatExceptionsbenn,,rjN)rprqrrrsrrtrjrHrrs
(-rjrcN|jtj|yrrKr1remove)rRr5s  rHcloseFileHandlerr	sGGIIIbMrjc8eZdZdZej
ZdZdZdZdZ	ejddZejdd	Zd
ezdzZ
ejdd
ZdZdZdZdZdZdZdZdZefdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%y%)&ConfigFileTestz5Reading logging config from a .ini-style config file.^(\w+) \+\+ (\w+)$aN
    [loggers]
    keys=root

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=WARNING
    handlers=hand1

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [formatter_form1]
    format=%(levelname)s ++ %(message)s
    datefmt=
    a
    [loggers]
    keys=root,parser

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=WARNING
    handlers=

    [logger_parser]
    level=DEBUG
    handlers=hand1
    propagate=1
    qualname=compiler.parser

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [formatter_form1]
    format=%(levelname)s ++ %(message)s
    datefmt=
    a
    [loggers]
    keys=root,parser

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=WARNING
    handlers=hand1

    [logger_parser]
    level=DEBUG
    handlers=
    propagate=1
    qualname=compiler.parser

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [formatter_form1]
    format=%(levelname)s ++ %(message)s
    datefmt=
    z
sys.stdoutz
sys.stboutzformatter=form1zformatter=misspelled_namea
    [loggers]
    keys=root

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=NOTSET
    handlers=hand1

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [formatter_form1]
    class=zS.ExceptionFormatter
    format=%(levelname)s:%(name)s:%(message)s
    datefmt=
    zclass=StreamHandlerzclass=logging.StreamHandlerag
    [loggers]
    keys=root,parser

    [handlers]
    keys=hand1, hand2

    [formatters]
    keys=form1, form2

    [logger_root]
    level=WARNING
    handlers=

    [logger_parser]
    level=DEBUG
    handlers=hand1
    propagate=1
    qualname=compiler.parser

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [handler_hand2]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stderr,)

    [formatter_form1]
    format=%(levelname)s ++ %(message)s
    datefmt=

    [formatter_form2]
    format=%(message)s
    datefmt=
    a%
    [loggers]
    keys=root,parser,compiler

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=WARNING
    handlers=hand1

    [logger_compiler]
    level=DEBUG
    handlers=
    propagate=1
    qualname=compiler

    [logger_parser]
    level=DEBUG
    handlers=
    propagate=1
    qualname=compiler.parser

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    kwargs={'stream': sys.stdout,}

    [formatter_form1]
    format=%(levelname)s ++ %(message)s
    datefmt=
    a
    [loggers]
    keys=root

    [handlers]
    keys=file

    [formatters]
    keys=

    [logger_root]
    level=DEBUG
    handlers=file

    [handler_file]
    class=FileHandler
    level=DEBUG
    args=("{tempfile}",)
    kwargs={{"encoding": "utf-8"}}
    ap
    [loggers]
    keys=root

    [handlers]
    keys=hand1

    [formatters]
    keys=form1

    [logger_root]
    level=WARNING
    handlers=hand1

    [handler_hand1]
    class=StreamHandler
    level=NOTSET
    formatter=form1
    args=(sys.stdout,)

    [formatter_form1]
    format=%(message)s ++ %(customfield)s
    defaults={"customfield": "defaultvalue"}
    z
    [loggers]
    keys=root

    [handlers]
    keys=screen

    [formatters]
    keys=

    [logger_root]
    level=DEBUG
    handlers=screen

    [handler_screen]
    level=DEBUG
    class=StreamHandler
    args=(sys.stdout,)
    formatter=
    ctjtj|}t	j
j|fddi|y)NrHrF)r4r5textwrapdedentrconfig
fileConfig)rDconfr3files    rHapply_configzConfigFileTest.apply_config's5{{8??401!!$CCFCrjcztj5}|j|jt	j
}|j
|j|j|j|jdg||jgdddy#1swYyxYwNr}r~r)
rcaptured_stdoutrconfig0rrrrnrrirDoutputrs   rHtest_config0_okzConfigFileTest.test_config0_ok+s

$
$
&	&&dll+&&(FKK))+,LL**,-!!#
"

!!"%	&	&	&sBB11B:c0tj5}tjt	j
|j}tj}|j|tjj|tj}|j|j|j!|j|j#dg||j#gdddy#1swYyxYwr)rrr4r5rrrconfigparserConfigParser	read_filerrrrrrnrri)rDrrcprs     rHtest_config0_using_cp_okz'ConfigFileTest.test_config0_using_cp_ok:s

$
$
&	&&;;xt||<=D**,BLLNN%%b)&&(FKK))+,LL**,-!!#
"

!!"%	&	&	&sC.DDcjtj5}|j|tjd}|j|j
|j|j
|jddg||jgdddy#1swYyxYwNcompiler.parserrr|rr	rrrrrrrnrrirDrrrs    rHtest_config1_okzConfigFileTest.test_config1_okL

$
$
&	&&f%&&'89FKK))+,LL**,-!!#
"


!!"%	&	&	&BB))B2cZ|jt|j|jyrr=rrconfig2rms rHtest_config2_failurez#ConfigFileTest.test_config2_failure[)T%6%6ErjcZ|jt|j|jyrr=rrconfig3rms rHtest_config3_failurez#ConfigFileTest.test_config3_failure_rrjctj5}|j|jt	j
}	t
#t$rt	jdYnwxYwtjjd|j|jd|jgdddy#1swYyxYwNjust testingr-ERROR:root:just testing
Got a [RuntimeError]
)rrrconfig4rrr	exceptionrPstdoutseekrZrXrirs   rHtest_config4_okzConfigFileTest.test_config4_okcs

$
$
&	&&dll+&&(F
2"n$
2!!.1
2JJOOAV__.A
C
!!"%	&	&	&s*0C

AA1.C
0A11AC

Cc<|j|jyNr)rconfig5rms rHtest_config5_okzConfigFileTest.test_config5_okrDLL1rjc<|j|jyr)rconfig6rms rHtest_config6_okzConfigFileTest.test_config6_okurrjc|tj5}|j|jt	j
d}t	j
d}|j
|j|j|j|j|j|jgd||jgdddtj5}|j|jt	j
d}|j|j|j
|j|j|jt	j
d}|j
|j|j|jj|j|jgd||jgdddy#1swYIxYw#1swYyxYw)Nrcompiler-hyphenatedrr)r{rrcompiler.lexer)rr)r}r)rr)r}r)rrrconfig1arrrrnrcriticalriconfig7rWrrDrr
hyphenateds    rHtest_config7_okzConfigFileTest.test_config7_okxs

$
$
&	&&dmm,&&'89F!**+@AJKK))+,LL**,- 1 1 34!!#	
"

!!"%'	&(
$
$
&	&&dll+&&'89FV__-KK))+,LL**,-&&'78FKK))+,LL**,- 1 1 34!!#

"

!!"%)	&	&)	&	&(	&	&sC	H%:D"H2%H/2H;c|j5tdd}tjdk(r|j	dd}|j
j
|}|j||j|dddtjjd}|jt|y#1swY>xYw)Nrtest_logging-X-rs\z\\)r/r)
check_no_resource_warningr6r1rFreplaceconfig8rrrrootr@rr)rDr5rrs    rHtest_config8_okzConfigFileTest.test_config8_oks

+
+
-	'(9:Bww$ZZf-ll))2)6Gg&g&	',,''*('26	'	'sA0B>>Ccj|j|jtjjdj
}|j
tjddi}|j|d|j
tjddd}|j|dy)Nrrtestztest ++ defaultvaluecustomvaluercustomfieldztest ++ customvalue)	rconfig9rrr@	formatterrrrZ)rDrresults   rHtest_config9_okzConfigFileTest.test_config9_oks$,,'LL))!,66	!!'"7"7"HI!78!!'"7"7=9#;<!67rjcv|j|jtjd}|j	|j
|j|j|j
|j
|j|jd|j	|j
y)Nsome_pristine_loggerF)disable_existing_loggers)rdisable_testrrrWrrCrDrs  rHtest_logger_disablingz$ConfigFileTest.test_logger_disablings$++,""#9:)$++,($++eL)rjcd}|j||jtjjdj
dy)Naw
            [loggers]
            keys=root

            [handlers]
            keys=hand1

            [formatters]
            keys=form1

            [logger_root]
            handlers=hand1

            [handler_hand1]
            class=StreamHandler
            formatter=form1

            [formatter_form1]
            format=%(levelname)s ++ %(message)s
            rhand1)rrZrrr@rF)rDtest_configs  rHtest_config_set_handler_namesz,ConfigFileTest.test_config_set_handler_namessC(	
+&**,55a8==wGrjcd}tjtj|}|j	t
tjj|y)Na
            [loggers]
            keys=root

            [handlers]
            keys=hand1

            [formatters]
            keys=form1

            [logger_root]
            handlers=hand1

            [handler_hand1]
            class=StreamHandler
            formatter=form1

            [formatter_form1]
            format=%(levelname)s ++ %(message)s

            prince
            )	r4r5rrr=rrrr)rDrrs   rH'test_exception_if_confg_file_is_invalidz6ConfigFileTest.test_exception_if_confg_file_is_invalids>.{{8??;78,(A(A4Hrjctjdd\}}tj||j	t
tjj|tj|y)Ntest_empty_.inirsuffix)
r/r0r1rKr=rrrrr)rDr4r5s   rH%test_exception_if_confg_file_is_emptyz4ConfigFileTest.test_exception_if_confg_file_is_emptysJ!!vFB
,(A(A2F
		"
rjcb|jttjjdy)Nfilenotfound)r=FileNotFoundErrorrrrrms rH,test_exception_if_config_file_does_not_existz;ConfigFileTest.test_exception_if_config_file_does_not_exists+W^^-F-FWrjc
tjdj}tjdd\}}	tj||jdtj|tjj|dtddd	d
ddd
itj|y#tj|wxYw)z.bpo-33802 defaults should not get interpolatedat
            [formatters]
            keys=default

            [formatter_default]

            [handlers]
            keys=console

            [handler_console]
            class=logging.StreamHandler
            args=tuple()

            [loggers]
            keys=root

            [logger_root]
            formatter=default
            handlers=console
            
test_logging_rrasciirFrFr:z5%(asctime)s [%(process)d] [%(levelname)s] %(message)sz[%Y-%m-%d %H:%M:%S %z]zlogging.Formatter)rdatefmtclass)versionr
formatters)rHdefaultsN)rrstripr/r0r1rencoderKrrrdictrR)rDinir4r5s    rH!test_defaults_do_no_interpolationz0ConfigFileTest.test_defaults_do_no_interpolationsoo&'	(!!HB	HHRG,-HHRLNN%% -2!&]'?%8$ 

&
 
IIbMBIIbMsA.CCN)&rprqrrrsr	rrWrconfig1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrtrjrHrr
s? / I I,G4G@H@oolL9Goo/1LMG*+*+G6oo35RSG'GT#GLG,G2L*D
&&$&-
&FF
&22)&V7$8*H0I6X*rjrc6eZdZdZeZdZdZdZdZ	dZ
dZy)	SocketHandlerTestzTest for SocketHandler objects.rOrctj|dx|_x|_|_	|j|j|jdx|_}|j|jjtjj}t|j t"r|d|j$|_n||j d|_d|_|j(j+|j(jd|j(j-|jt/j0d|_y#t$r}||_Yd}~yd}~wwxYw)ztSet up a TCP server to receive log messages, and a SocketHandler
        pointing to that server's address and port.N{Gz?rOrr)rrIr	sock_hdlrserver_exceptionserver_classaddress
handle_socketrr^rrrr@
SocketHandler
isinstanceserver_addressr_r
log_outputr1rLrBr	SemaphorerXrDrr&hclss    rHrIzSocketHandlerTest.setUp:s,	t?CCCdnt'<	#'#4#4T\\595G5G$O
ODK&LLN	--f++U3!+v{{;DN!&"7"7>DN&&t'7'7'@'@'CD##DNN3 **1-	$%D!	s>E""	E<+E77E<cF	|jr?|jj|j|jj|jr|jjtj|y#tj|wxYw)zShutdown the TCP server.N)rr1rLrKrrrrSrms rHrSzSocketHandlerTest.tearDownTsj	$~~  ..t~~>$$&{{  "d#Hd#A1B		B c|j}	|jd}t|dkrytjd|d}|j|}t||kr/||j|t|z
z}t||kr/tj|}tj|}|xj|jdzz
c_	|jj)Nrw>Lr
)
connectionrecvr[structunpackpickleloadsrrrrrXr)rDrequestconnchunkslenobjrs       rHrzSocketHandlerTest.handle_socket_s!!IIaLE5zA~==u-a0DIIdOEe*t#		$U*; <<e*t#,,u%C**3/FOOvzzD00OLL  "rjc`|jr|j|jtjd}|j	d|j
j
|jd|j
j
|j|jdy)Ntcpreggs
spam
eggs
)
rskipTestrrrrXrrrZrrs  rHtest_outputzSocketHandlerTest.test_outputnsy  MM$//0""5)VV.9rjcR|jr|j|jd|j_|jj	t
d#t$r|jjdYnwxYw|jjdtj}|j|jj|tj|jj|z
dz|jjdy)Ng@zDeliberate mistakez
Never sentzNever sent, eitherrNzNor this)rr5r
retryStartrrrr1rrryr	retryTimer{)rDnows  rH
test_noserverzSocketHandlerTest.test_noserverys  MM$//0%(!	5344	5&&|4	534iik4>>33S9

4>>++c1E9:z*sA$BBN)rprqrrrsr)rrrIrSrr6r;rtrjrHrr1s** LG.4	$
#	:+rjrzUnix sockets requiredc,eZdZdZeedreZdZy)UnixSocketHandlerTestz)Test for SocketHandler with unix sockets.rCctj|_|jtj
|jtj|yr)rcreate_unix_domain_namerrrrRrrIrms rHrIzUnixSocketHandlerTest.setUp8$<<>	(($,,7%rjN)	rprqrrrshasattrrrErrIrtrjrHr=r=s4vy!+&rjr=c0eZdZdZeZdZdZdZdZ	dZ
y)DatagramHandlerTestzTest for DatagramHandler.rctj|dx|_x|_|_	|j|j|jdx|_}|j|jjtjj}t|j t"r|d|j$|_n||j d|_d|_|j(j+|j(jd|j(j-|jt/j0|_y#t$r}||_Yd}~yd}~wwxYw)zvSet up a UDP server to receive log messages, and a DatagramHandler
        pointing to that server's address and port.NrrOrr)rrIrrrrrhandle_datagramrr^rrrr@DatagramHandlerrrr_rrr1rLrBrrrXrs    rHrIzDatagramHandlerTest.setUps(	t?CCCdnt'<	#'#4#4T\\595I5I4$Q
QDK&LLN	//f++U3!+v{{;DN!&"7"7>DN&&t'7'7'@'@'CD##DNN3 (	$%D!	s>E!!	E;*E66E;cF	|jr|jj|jr?|jj	|j|jjtj|y#tj|wxYw)zShutdown the UDP server.N)rrrr1rLrKrrSrms rHrSzDatagramHandlerTest.tearDownsj	${{  "~~  ..t~~>$$&d#Hd#r"c,tjdd}|jt|d}t	j
|}t
j|}|xj|jdzz
c_|jjy)Nr$rr%)r(packpacketr[r*r+rrrrrXr)rDr,r/rJr0rs      rHrEz#DatagramHandlerTest.handle_datagramsk{{4#D	
+ll6"&&s+6::,,rjc|jr|j|jtjd}|j	d|j
j
|j
j|j	d|j
j
|j|jdy)Nudprr3r4)
rr5rrrrXrrMrZrrs  rHr6zDatagramHandlerTest.test_outputs  MM$//0""5)VV.9rjN)rprqrrrsr7rrrIrSrEr6rtrjrHrCrCs%$ LG)4	$
:rjrCc,eZdZdZeedreZdZy)UnixDatagramHandlerTestz,Test for DatagramHandler using Unix sockets.rCctj|_|jtj
|jtj|yr)rr?rrrrRrCrIrms rHrIzUnixDatagramHandlerTest.setUps8$<<>	(($,,7!!$'rjN	rprqrrrsrArrJrrIrtrjrHrNrNs7vy!-(rjrNc6eZdZdZeZdZdZdZdZ	dZ
dZy)	SysLogHandlerTestz!Test for SysLogHandler using UDP.rctj|dx|_x|_|_	|j|j|jdx|_}|j|jjtjj}t|j t"r'||j d|j$f|_n||j |_d|_|j(j+|j(jd|j(j-|jt/j0|_y#t$r}||_Yd}~yd}~wwxYw)ztSet up a UDP server to receive log messages, and a SysLogHandler
        pointing to that server's address and port.Nrrrj)rrIrsl_hdlrrrrrErr^rrrr@rZrrr_rrr1rLrBrrrXrs    rHrIzSysLogHandlerTest.setUps4	t=AAAdlT%:	#'#4#4T\\595I5I4$Q
QDK&LLN	--f++U3!6!6q!96;; GHDL 5 56DL&&t'7'7'@'@'CD##DLL1 (	$%D!	s>E..	F7FFcF	|jr|jj|jr?|jj	|j|jjtj|y#tj|wxYw)zShutdown the server.N)rrrTr1rLrKrrSrms rHrSzSysLogHandlerTest.tearDownsj	${{  "||  ..t||<""$d#Hd#r"cZ|j|_|jjyr)rJrrXr)rDr,s  rHrEz!SysLogHandlerTest.handle_datagrams!..rjc,|jr|j|jtjd}|j	d|j
j
tj|j|jd|j
jd|j_
|j	d|j
j
tj|j|jd|j
jd|j_|j	d|j
j
tj|j|jdy)Nslhspäm
<11>spämFs	<11>spämuhäm-s<11>häm-späm)rr5rrrrXrrr^rZrrMrT
append_nulidentrs  rHr6zSysLogHandlerTest.test_outputs  MM$//0""5)Y'../*@A"'Y'../*<=&Y'../*GHrjcBtjd}|jj|jj|j
d|jjtj|j|jdy)NrXrYrZ)rrrTrKrXrMrrrr^rZrrs  rHtest_udp_reconnectionz'SysLogHandlerTest.test_udp_reconnection0sk""5)Y'../*@ArjN)rprqrrrsr7rrrIrSrEr6r^rtrjrHrRrRs,, LG)4	$I&BrjrRc,eZdZdZeedreZdZy)UnixSysLogHandlerTestz)Test for SysLogHandler with Unix sockets.rCctj|_|jtj
|jtj|yr)rr?rrrrRrRrIrms rHrIzUnixSysLogHandlerTest.setUp@r@rjNrPrtrjrHr`r`8s4vy!-&rjr`z$IPv6 support required for this test.c4eZdZdZeZdZfdZfdZxZ	S)IPv6SysLogHandlerTestz&Test for SysLogHandler with IPv6 host.)z::1rchtj|j_tt
|yr)rAF_INET6rrGrrcrIrs rHrIzIPv6SysLogHandlerTest.setUpOs#+1??(
#T02rjchtj|j_tt
|yr)rAF_INETrrGrrcrSrs rHrSzIPv6SysLogHandlerTest.tearDownSs#+1>>(
#T35rj)
rprqrrrsr7rrrIrSrrs@rHrcrcFs!1 LG366rjrcc"eZdZdZdZdZdZy)HTTPHandlerTestzTest for HTTPHandler.c`tj|tj|_y)ztSet up an HTTP server to receive log messages, and a HTTPHandler
        pointing to that server's address and port.N)rrIrrrXrms rHrIzHTTPHandlerTest.setUp\s	t (rjc||j|_t|j|_|jdk(r9	t	|j
d}|jj||_|jd|j|jjy#d|_YGxYw)NrMzContent-Length)
commandrrXlog_dataintheadersrfilera	post_data
send_responseend_headersrXr)rDr,rlens   rHhandle_requestzHTTPHandlerTest.handle_requestbs .
<<6!
&7??+;<=!(!3!3D!9	c"	
&!%s8B00	B;cLtjd}|j}|j|jjddD]}d}|r	ddl}tjjt}tjj|d}|j|j}|j||j|}	nd}d}	t!||j"d|x|_}
|
j'|
j(j+d	|
j,z}|xr|}tjj/|d
|	d|_d|_|j5|j0d
D](}
|
|j0_|j8j;d}|j=||j8j+|j?|j2jd
|j?|j@|
|
dk(r tC|j2jD}n$tC|jFjId}|j?|ddg|j?|ddg|j?|d|g+|j$jK|jj|j0|j0jMy#t$rd}YCwxYw)Nhttprrrzkeycert.pem)cafiler)r zlocalhost:%dz/frob)foobar)securecontextcredentials)rLrMrYrLrFrFfuncNamer6r)'rrr1rLr@sslr1rXdirname__file__r
SSLContextPROTOCOL_TLS_SERVERload_cert_chaincreate_default_contextImportErrorr
rvrrrrserver_portr`h_hdlrrnrBrerXrMrrZrmrqueryrrdecoderrK)rDrr1r|rrherelocalhost_certr r}rhost
secure_clientrerds                rHr6zHTTPHandlerTest.test_outputos""6*&&!!$"2"2";";A">?#0	 F#D
P77??84D%'WW\\$
%FN ^^C,C,CDF**>:!888OG#1$8K8K48$I
IDK&LLNLL!F$6$66D"-vM!**66tW>K?FCQ7SDK!DM""4;;/)
2%+"""$S!!!#  !3!3W=  v6U? !4!45A !6!6w!?@A  6VH5  :@  5C51
2 
KK**4;;7KKa0	 
#"!F"sLL#"L#N)rprqrrrsrIrvr6rtrjrHririWs )5 rjric(eZdZdZdZdZdZdZy)
MemoryTestz*Test memory persistence of logger objects.c<tj|i|_y)z8Create a dict to remember potentially destroyed objects.N)rrI
_survivorsrms rHrIzMemoryTest.setUpstrjc|D]:}t|t|f}tj||j|<<y)zKWatch the given objects for survival, by creating weakrefs to
        them.N)rrrzr{r)rDr2r0keys    rH_watch_for_survivalzMemoryTest._watch_for_survivals<	4CS'49$C#*;;s#3DOOC 	4rjctjg}|jjD]!\\}}}||j	|#|r/|jdt
|dj|fzyy)z;Assert that all objects watched for survival have survived.Nz;%d objects should have survived but have been destroyed: %sz, )gccollectrrr]r^r[r)rDdeadid_repr_r{s     rH_assertTruesurvivalzMemoryTest._assertTruesurvivals	

!%!6!6!8	#LS%#u}E"	#II.14TDIIdO0LM
NrjcD|jjtjtjd}|j||jtj|jj|j|j|j|jdg~|jtjd}|j|j|jddgy)Nrz)rzr8r~)rzr8r)r1r7rrrrr8rrnrir)rDrzr{s   rHtest_persistent_loggersz"MemoryTest.test_persistent_loggerss	
!!',,/&  %W]]#t0023		$##%&!
	
  "&		$##%&!!
	rjN)rprqrrrsrIrrrrtrjrHrrs4
4
NrjrceZdZdZdZy)EncodingTestctjd}tdd}d}	tj|d}|j	|	|j||j
||jt|d}	|j|jj||j	tjj|rtj|yy#|j
||jwxYw#|jwxYw#tjj|rtj|wwxYw)Nrrztest_logging-1-ufoo€rFr)rrr6rlrBrrLrKrrZrarstripr1rXisfiler)rDrr5rrrs      rHtest_encoding_plain_filez%EncodingTest.test_encoding_plain_files'
F$5
6	))"w?GNN7#
 D!!!'*

R'*A
  !2D9	ww~~b!		"
"!!'*

	ww~~b!		"
"s;(D>D.D>.D)<D>#D&&D>)D;;D>>7E5ctjd}d}tjd}d|_tj}||d}tj|}|j|	|j||j||j|j}|j|dy#|j||jwxYw)Nruдо свиданияcp1251stricts 
)rrcodecs	getwriterrHr4BytesIOr9rBrrLrKrXrZ)rDrmessagewriter_classr6writerrrhs        rHtest_encoding_cyrillic_unicodez+EncodingTest.test_encoding_cyrillic_unicodes'Q''1 (fh/''/w	KK g&MMOOOJK
g&MMOs8C

#C0N)rprqrrrrrtrjrHrrs
2LrjrceZdZdZdZy)WarningsTestc	*tj5tjd|j	tjdtj
dttj}tj|}tjd}|j|tjd|j||j}|j|j!|j#ddtj}tj$d	td
d|d|j}|j|j'|d
dddy#1swYyxYw)NTFalways)categorypy.warningszI'm warning you...z UserWarning: I'm warning you...
rExplicitdummy.py*z
Dummy linez0dummy.py:42: UserWarning: Explicit
  Dummy line
)warningscatch_warningsrcaptureWarningsrfilterwarningsUserWarningr4r5r9rrBwarnrLrXrKrfindshowwarningrZ)rDr6rRrrha_files      rH
test_warningszWarningsTest.test_warnings	s-

$
$
&	F##D)OOG33U;##H{C[[]F%%f-A&&}5Fa MM./  #!A
GGIqvv&IJAN[[]F  [*b!'
7!ALLNQD
F)	F	F	FsE+F		Fctj5tjd|j	tjdtj
d}|j
|jgtjdtdd|j
t|jd|j|jdtjdddy#1swYyxYw)	NTFrrrrrr)
rrrrrrrZr@rrr[assertIsInstanceNullHandlerrs  rHtest_warnings_no_handlersz&WarningsTest.test_warnings_no_handlers$	s

$
$
&
	K##D)OOG33U;&&}5FV__b1  [*bIS115!!&//!"4g6I6IJ
	K
	K
	KsCC33C<N)rprqrrrrrtrjrHrr
	sF0Krjrc.tj||Sr)rr;)rrs  rH
formatFuncr2	sVW--rjceZdZddZy)myCustomFormatterNcyrrt)rDfmtrs   rHrzmyCustomFormatter.__init__6	srjr)rprqrrrrtrjrHrr5	s
rjrc*tjSr)rr9rtrjrHhandlerFuncr9	s  ""rjceZdZy)
CustomHandlerNrprqrrrtrjrHrr<	rjrceZdZy)CustomListenerNrrtrjrHrr?	rrjrceZdZy)CustomQueueNrrtrjrHrrB	rrjrc*tjSr)queueQueuertrjrH
queueMakerrE	s;;=rjcfd}|S)NcF|jdt|g|i|S)Nrespect_handler_level)
setdefaultr)rr@r3rs   rHfunczlistenerMaker.<locals>.funcI	s*13HIe9h9&99rjrt)arg1arg2rrs  ` rH
listenerMakerrH	s:Krjc
NeZdZdZej
ZdZddddiidddd	d
diddgd
dZddddiidddd	d
didddgd
iddidZddddiidddd	d
didddiiddgd
dZ	ddddiidddd	ddidddgd
iddidZ
ddddiiddddd
didddgd
iddidZddddiidddd	d
didddgd
iddidZddddiidddd	d
didddgd
iddidZ
ddedzddidddd	d
did	dgd
dZdeddedzddedddddd	d
ddeidd	dgd
dZddddiidedzdd	d
didddgd
iddidZddddiidedzdd	d
dd idddgd
iddidZddddiidddd	d
did!ddgd
iddidZdd"dddiidddd	d
diddgd
id#ddid$Zdd%dddiidddd	d
diddgd
id#ddid$Zddddiiddddd
didddgd
idd	idZdd%dddiiddd&iid'Zdd%ddd&iiddd&iid'Zddddiid(d)diidddd	d
d(gd*iddd(gd+iddgd
d,Zddddiidddd	d
did-dd.idddgd
iddid/Zdddiidddd	d
did-dd.idddgd
iddid0Zd1dddiidddd	d
did-dd.idddgd
iddid/Zddddiidddd	d
d2d3d4d5iddgd
dZddd6d7d8id9idddd	d
diddgd
dZ dd:d;d<d=iddd:d>d?d@d:dAddBdCdDddEgdFdGidHZ!ddedzdd"dIidddd	d
didJddgdFdGidHZ"ddedzdd"dKidddd	d
didJddgdFdGidHZ#ddedLzdd"dKidddd	d
didJddgdFdGidHZ$ddedd"dIidddd	d
didJddgdFdGidHZ%ddedMd7dNidOidddd	d
didJddgdFdGidHZ&ddPdQidRdSgdTdUddVgd
dWZ'dXZ(dYZ)dZZ*efd[Z+d\Z,d]Z-d^Z.d_Z/d`Z0daZ1dbZ2dcZ3ddZ4deZ5dfZ6dgZ7dhZ8diZ9djZ:dkZ;dlZ<dmZ=dnZ>ddpZ?e@jdqZBe@jdrZCe@jdsZDdtZEduZFdvZGdwZHdxZIdyZJdzZKd{ZLd|ZMd}ZNd~ZOdZPdZQdZRdZSeTjdZVdZWyo)ConfigDictTestz)Reading logging config from a dictionary.rrform1rz%(levelname)s ++ %(message)srlogging.StreamHandlerrzext://sys.stdout)rrrr6rrr@)rrr@rrr8r)rrr@loggersrzext://sys.stdboutNTOSETWRANINGmisspelled_namez.ExceptionFormatterz"%(levelname)s:%(name)s:%(message)s)()rz.formatFunc)rform2form3r)rhand2z.CustomHandlerzinvalid parameter name)rrrr6rrF)compilerr)rrrr@rrTr)rincrementalr@rfilt1rF)rrrr6filtersrr)rrrr@rrzcfg://true_formatterszcfg://handler_configs[hand1])rtrue_formattershandler_configsrr@rr)rrrr@rrrr{!
)rz
terminator)rrrr6rz%(message)s ++ %(customfield)srdefaultvalue)rr	mySimpleFormatterz1%(asctime)s (%(name)s) %(levelname)s: %(message)s$)rstyle)rrrzlogging.handlers.MemoryHandler
fileGlobal)rcapacityrrr)rbufferGlobalmymodulertrue)rr@rg)rrr@r)rrvalidatemy_test_logger_custom_formatter)rrrz.myCustomFormatterz2%(levelname)s:%(name)s:%(message)s:%(customfield)smyvalue)rrr	rlogging.FileHandlerzlogging.handlers.QueueHandlerh1)rr@)rahr	rr@rcBtjj|yr)rr
dictConfig)rDrs  rHrzConfigDictTest.apply_configys!!$'rjcRtj|}|j||yr)rgetHandlerByNamer)rDrFrqrRs    rH
check_handlerzConfigDictTest.check_handler|s"$$T*a%rjctj5}|j|j|j	dt
jtj}|j|j|j|j|jdg||jgdddy#1swYyxYw)Nrrr)rrrrrrr9rrrnrrirs   rHrzConfigDictTest.test_config0_oks

$
$
&	&&dll+w(=(=>&&(FKK))+,LL**,-!!#
"

!!"%	&	&	&sB3CCcjtj5}|j|tjd}|j|j
|j|j
|jddg||jgdddy#1swYyxYwrrrs    rHrzConfigDictTest.test_config1_okrrcZ|jt|j|jyrrrms rHrz#ConfigDictTest.test_config2_failurerrjcZ|jt|j|jyr)r=rrconfig2arms rHtest_config2a_failurez$ConfigDictTest.test_config2a_failure)T%6%6

FrjcZ|jt|j|jyr)r=rrconfig2brms rHtest_config2b_failurez$ConfigDictTest.test_config2b_failurerrjcZ|jt|j|jyrrrms rHrz#ConfigDictTest.test_config3_failurerrjctj5}|j|j|j	dt
j	t#t$rtjdYnwxYwtjjd|j|jd|jgdddy#1swYyxYw)Nrrrr)rrrrrrr9rrrPrrrZrXrirDrs  rHrzConfigDictTest.test_config4_oks

$
$
&	&&dll+w(=(=>
2"n$
2!!.1
2JJOOAV__.A
C
!!"%	&	&	&s*<C
AA=:C<A==ACC"ctj5}|j|j	t	#t$rtjdYnwxYwtjjd|j|jd|jgdddy#1swYyxYwr)
rrrconfig4arrrrPrrrZrXrirs  rHtest_config4a_okzConfigDictTest.test_config4a_oks

$
$
&	&&dmm,
2"n$
2!!.1
2JJOOAV__.A
C
!!"%	&	&	&s'B9
<AB9AAB99Cch|j|j|jdty)Nrr)rrrrrms rHrzConfigDictTest.test_config5_oks'DLL17M2rjcZ|jt|j|jyr)r=rrrrms rHtest_config6_failurez#ConfigDictTest.test_config6_failures)T%6%6Erjctj5}|j|jt	j
d}|j
|j|j|j|jddg||jgdddtj5}|j|j|jdtjt	j
d}|j|jt	j
d}|j
|j|j|j|jddg||jgdddy#1swYxYw#1swYyxYw)	Nrrrrrrrrr}r)rrrrrrrrnrrirrr9rCrrs   rHrzConfigDictTest.test_config7_oks

$
$
&	&&dll+&&'89FKK))+,LL**,-!!#
"


!!"%	&
$
$
&	&&dll+w(=(=>&&'89FOOFOO,&&'78FKK))+,LL**,-!!#
"


!!"%	&	&	&	&	&	&sBF4C%G4F>G
ctj5}|j|jt	j
d}|j
|j|j|j|jddg||jgdddtj5}|j|j|jdtjt	j
d}|j|j|j
|j|j|jt	j
d}|j
|j|j|j|jgd||jgdddy#1swYJxYw#1swYyxYw)Nrrrrrr)r$r%rrr}r)rrrrrrrrnrrirrr9rWrrs   rHtest_config_8_okzConfigDictTest.test_config_8_oks

$
$
&	&&dll+&&'89FKK))+,LL**,-!!#
"


!!"%	&
$
$
&	&&dll+w(=(=>&&'89FV__-KK))+,LL**,-&&'78FKK))+,LL**,-!!#

"

!!"%'	&	&	&	&	&	&sBG2D#G?2G<?Hctj5}|j|j|j	dt
jtjd}tjd}|j|j|j|j|j|j|jgd||jgdddtj5}|j|j|j	dt
jtjd}|j|j|j|j|j|jtjd}|j|j|j|jj|j|jgd||jgdddy#1swYixYw#1swYyxYw)Nrrrrrrr)rrrrrrr9rrrnrrriconfig8arWrrs    rHtest_config_8a_okz ConfigDictTest.test_config_8a_ok
s

$
$
&	&&dmm,w(=(=>&&'89F!**+@AJKK))+,LL**,- 1 1 34!!#	
"

!!"%)	&*
$
$
&	&&dmm,w(=(=>&&'89FV__-KK))+,LL**,-&&'78FKK))+,LL**,- 1 1 34!!#

"

!!"%+	&	&+	&	&*	&	&sC)I%EI2%I/2I;ctj5}|j|j|j	dt
jtjd}|j|j|jg||j|j|j|j|jg||j|j|j|j|jdg|dddy#1swYyxYw)Nrrrr$)
rrrrrrr9rrrnriconfig9aconfig9brs   rHtest_config_9_okzConfigDictTest.test_config_9_okB
s

$
$
&	&dll+w(=(=>&&'89FKK))+,!!"V!4dmm,KK))+,!!"V!4dmm,KK))+,!!#
"
			sDD<<Ectj5}|j|j|j	dt
jtjd}|j|jtjd}|j|jtjd}|j|jtjd}|j|j|jddg|dddy#1swYyxYw	Nrrrrzcompiler.parser.codegen)rr|r%r)rrrconfig10rrr9rrrnrrirs   rHtest_config_10_okz ConfigDictTest.test_config_10_okU
s

$
$
&	&dmm,w(=(=>&&'89FNN4,,./&&z2FNN4,,./&&'78FNN4,,./&&'@AFLL**,-!! #
"
			sD!D??Ec:|j|jyr)rconfig11rms rHtest_config11_okzConfigDictTest.test_config11_oki
sT]]+rjcZ|jt|j|jyr)r=rrconfig12rms rHtest_config12_failurez$ConfigDictTest.test_config12_failurel
)T%6%6

FrjcZ|jt|j|jyr)r=rrconfig13rms rHtest_config13_failurez$ConfigDictTest.test_config13_failureo
r;rjctj5}|j|jtj
d}|j
|jd|j
|jdt	jd|j|jjddddy#1swYyxYw)Nrr{rExclamationz
Exclamation!
)
rrrconfig14rr"rZrzrrrCrXrZ)rDrrRs   rHtest_config14_okzConfigDictTest.test_config14_okr
s

$
$
&	J&dmm,!!'*AQUUE*Q\\51OOM*OOFOO-667GHI
	J	J	JsB*CCc0|j5tdd}ddd|ddiddgid	}|j||j|dddtjj
d
}|j
t|y#1swY>xYw)NrrrrrrF)rfilenamerHr@r
r)rr6rrrr@rr)rDr5rrs    rHtest_config15_okzConfigDictTest.test_config15_ok{
s

+
+
-	&(9:B!6$&$+F
f%f%%	&(,,''*('26+	&	&s>BBcj|j|jtjd}|jjtjddd}|j|d|jjtjddi}|j|dy)NrHellorrzHello ++ customvaluerzHello ++ defaultvalue)rconfig16rr"rrrrZ)rDrRrs   rHtest_config16_okzConfigDictTest.test_config16_ok
s$--(g&##G$9$9M:%<=!78##G$9$9
G%!89rjNc|jd}tjjd|}|j	|j
j
|j}|j
j	tjtjtj}|jd|jd|ftjdt!|}||z}d}t!|}	|	dkDr$|j#||d}
||
z
}|	|
z}	|	dkDr$|j%|j
j
dtjj't)j*|y#|j
j
dtjj't)j*|wxYw)NrFrg@rOr$)rrrlistenrrrrrMrrgSOCK_STREAM
settimeoutconnectr(rIr[sendrK
stopListeningrr)rDtextverifyrrr%r/rh	sentsofarleftsents           rHsetup_via_listenerz!ConfigDictTest.setup_via_listener
s[{{7#NN!!!V,			vv	

	,==1C1CDDOOC LL+t,-;;tSY/DtAIq6D(yy9:/T!	(
JJL
GGLLNN((*((+
GGLLNN((*((+sB/F3FAG"ctj5}|jtj|j
|j
dtjtjd}|j|jtjd}|j|jtjd}|j|jtjd}|j|j|jddg|dddy#1swYyxYwr2)rrrVjsondumpsr3rrr9rrrnrrirs   rHtest_listen_config_10_okz'ConfigDictTest.test_listen_config_10_ok
s

$
$
&	&##DJJt}}$=>w(=(=>&&'89FNN4,,./&&z2FNN4,,./&&'78FNN4,,./&&'@AFLL**,-!! #
"
			sD4EEctj5}|jtjt
jtjd}|j|j|j|j|jddg||jgdddy#1swYyxYwr)
rrrVrrrrrrrrnrrirs   rHtest_listen_config_1_okz&ConfigDictTest.test_listen_config_1_ok
s

$
$
&	&&##HOON4J4J$KL&&'89FKK))+,LL**,-!!#
"


!!"%	&	&	&sB,C

Ccd}d}tjd}tjtj
}t
j5}|j|||j|j|j|jddd|jg|jddgdt
j5}|j|tjd}|j|j|j|jddd|jd	d
g||jddgdt
j5}|j|ddd|tjd}|j|j|j|jddd|jdd
g||jddgdy#1swYxYw#1swYxYw#1swYMxYw)Ncyrrtstuffs rHverify_failz6ConfigDictTest.test_listen_verify.<locals>.verify_fail
srjc|dddS)NrJrtr_s rHverify_reversez9ConfigDictTest.test_listen_verify.<locals>.verify_reverse
s2;rjrrrrr)rcr$r%rJr'r()
rrrrrrrrrVrrnrri)rDrarcrto_sendrs      rHtest_listen_verifyz!ConfigDictTest.test_listen_verify
sE		""#45//."8"89
$
$
&	.&##G[9KK))+,LL**,-		.
	
b0
+		,
$
$
&	.&##G,&&'89FKK))+,LL**,-	.	

		
	

+		,
$
$
&	.&##GDbDM>B&&'89FKK))+,LL**,-	.	

		
	

+		,Y	.	.	.	.$	.	.s'AH2(A%H?A,I2H<?IIcZ|jt|j|jyr)r=r_r
bad_formatrms rHtest_bad_formatzConfigDictTest.test_bad_format#s*d&7&7Irjctj|j}d|ddd<|j|t	j
djd}|j|jtj|j|jjtj|jtt	jddgy)	Nz-${asctime} (${name}) ${levelname}: ${message}rrrrrrr)r#deepcopyrgrrrr@rrr<r_styleStringTemplateStylerZsortedgetHandlerNamesrDrrs   rH!test_bad_format_with_dollar_stylez0ConfigDictTest.test_bad_format_with_dollar_style&st/>m|01(;&!##J/88;gnngoo>g//66%99	; 7 7 9:(,7	9rjc|j|jtjdjd}|j|jtyNrr)rcustom_formatter_class_validaterrr@rrrrDrs  rH)test_custom_formatter_class_with_validatez8ConfigDictTest.test_custom_formatter_class_with_validate2sJ$>>?##$EFOOPQRg//1CDrjc|j|jtjdjd}|j|jtyrr)r custom_formatter_class_validate2rrr@rrrrts  rH*test_custom_formatter_class_with_validate2z9ConfigDictTest.test_custom_formatter_class_with_validate27sJ$??@##$EFOOPQRg//1CDrjc|jj}d|ddd<|j|tjdj
d}|j
|jty)Nrrrrrr)	rsr#rrrr@rrrros   rH9test_custom_formatter_class_with_validate2_with_wrong_fmtzHConfigDictTest.test_custom_formatter_class_with_validate2_with_wrong_fmt<sn55::<14|W%g.	
&!##$EFOOPQRg//1CDrjcZ|jt|j|jyr)r=r_r custom_formatter_class_validate3rms rH*test_custom_formatter_class_with_validate3z9ConfigDictTest.test_custom_formatter_class_with_validate3Es *d&7&79^9^_rjcZ|jt|j|jyr)r=r_rcustom_formatter_with_functionrms rH,test_custom_formatter_function_with_validatez;ConfigDictTest.test_custom_formatter_function_with_validateH *d&7&79\9\]rjcZ|jt|j|jyr)r=r_rcustom_formatter_with_defaultsrms rH,test_custom_formatter_function_with_defaultsz;ConfigDictTest.test_custom_formatter_function_with_defaultsKrrjc&dgdddddddd	gd
ggdd}tjj|}|j|j	d
d|j|j	dd|j|j	dd|j|j	dd	|j|j	dd|j|j	dd|j	d}|j|jdgd|j
t|jd|j
t|jd|j
t|jdy)N)rr)ribcr&r)rr)g)rRrrjrlrrq)ozcfg://alistp)atuplealistadictnest1nest2nest3zcfg://atuple[1]rzcfg://alist[1]rzcfg://nest1[1][0]rRzcfg://nest2[1][1]z
cfg://adict.dzcfg://adict[f]zcfg://nest3rzcfg://nosuchzcfg://!zcfg://adict[2])	rrBaseConfiguratorrZconvertpopr=KeyErrorr_)rDrbcrs    rHtest_baseconfigzConfigDictTest.test_baseconfigNsE$Q(+C:s+.

^^
,
,Q
/$56:$45s;$78#>$78#>O4c:$45q9JJ}%q?3(BJJ?*bjj)<(BJJ0@ArjcpddlmGfddtj}dddg}|dd	g
}dd||d
iddgdd}t	j
5}|j
|tjdddd|jjdy#1swY*xYw)Nr)
namedtuplec,eZdZfdZfdZxZS)1ConfigDictTest.test_namedtuple.<locals>.MyHandlerc2t||i|||_yr)rrresource)rDrr2r3rrs    rHrz:ConfigDictTest.test_namedtuple.<locals>.MyHandler.__init__is $1&1,4
rjcz|xjd|jjz
c_t||SN )rrtyperr?)rDrrs  rHr?z6ConfigDictTest.test_namedtuple.<locals>.MyHandler.emitms2

$--"4"4!566
w|F++rjr)rrs@rH	MyHandlerrhs
5
,
,rjrResourcerlabelsmy_typeri)rrr	myhandler)rrrrr
zsome logzsome log my_type
)
collectionsrrr9rrrrrZrX)rDrrrrrrs      @rHtest_namedtuplezConfigDictTest.test_namedtupleds*	,--	,j68*<=C59# ( &K=A	

$
$
&	%&f%LL$	%	
*,@A	%	%s'B,,B5cld}|jdd|gddgtj_y)Ncyr1rt)rs rHrzAConfigDictTest.test_config_callable_filter_works.<locals>.filter_srjrr8rrrrrrrrDrs  rH!test_config_callable_filter_worksz0ConfigDictTest.test_config_callable_filter_workss9	G	"J
	')#rjctjd}|jdd|gddgtj_y)Nrrr8rr)rrrrrrs  rHtest_config_filter_worksz'ConfigDictTest.test_config_filter_workssB..-G	"J
	')#rjcGdd}|}|jdd|gddgtj_y)NceZdZdZy)BConfigDictTest.test_config_filter_method_works.<locals>.FakeFiltercyr1rt)rDrs  rHrzIConfigDictTest.test_config_filter_method_works.<locals>.FakeFilter.filtersrjN)rprqrrrrtrjrH
FakeFilterrs
rjrrr8rrr)rDrrs   rHtest_config_filter_method_worksz.ConfigDictTest.test_config_filter_method_workssG		,G	"J
	')#rjc	Gdd}dd|fD]*}|jt|jdd|gdd,y)NceZdZy);ConfigDictTest.test_invalid_type_raises.<locals>.NotAFilterNrrtrjrH
NotAFilterrsrjrrr8rr)r=r_r)rDrrs   rHtest_invalid_type_raisesz'ConfigDictTest.test_invalid_type_raisessIa.	G!!gY'OP
	rjctj|j}tdd}||ddd<|||ddd<|||ddd<d}	|j	|tjd}|jttjddg|j|j|jjtjd	tjd
tjdt!j"t j$drJ|jj&j)rn%t!j"t j$drJ|jj&j+t-|d
5}|j/j1}ddd|jgd|r|jj3tjd}|r|j5t6||y|j5t8j:|y#1swYxYw#|r|jj3tjd}|r|j5t6||w|j5t8j:|wxYw)Nrztest_logging-cqh-r@rrDr	rlistenerrzr{bazzqueue not emptyrFr)rzr{r)r#rjconfig_queue_handlerr6rrrrZrmrnassertIsNotNonerrrrrrsleeping_retryr^remptyrrrarYrrrr1r)	rDqspeclspeccdr5qhrrrRs	         rHdo_queuehandler_configurationz,ConfigDictTest.do_queuehandler_configurations:
]]444
5
F$7
8+-:tZ(,1BzN4 )/4BzN4 ,
	/b!))$/BVG$;$;$=>tM  -KKMM% LLOOE"(()=)=):<;;$$**,(()=)=):<
KK""$b7+
-qvvx**,
-T#89  "((.A 0!R8		2.
-
-  "((.A 0!R8		2.s,D6I/1I/<I#I/#I,(I//A-Kc0t}tdzdd}tdzdddd}dtdztdz||f}dtdz|tf}tj||D]\}}|j||dd	td
df}dd	td
df}tj||D]a\}}|||jt5}|j||dddtj}	|j|	d
cy#1swY3xYw)Nz.CustomQueuerb)rmaxsizez.listenerMakerT)rrrrz.queueMakerz.CustomListenerrwrrzr{z Unable to configure handler 'ah')rrpr	itertoolsproductrror=r_rorrZ)
rDqdqdlqvalueslvaluesrrctxrs
          rHtest_config_queue_handlerz(ConfigDictTest.test_config_queue_handlers?M^+

--%)	
M18n3LbRST$55r>J%--gw?	=LE5..ue<	=CU+CU+%--gw?	FLE5}"":.
A#225%@
Acmm$CS"DE
	F
A
AsDD	cddddddidddgdid	}tjd}|j|j|j	||j|j|j	d
di|j|j|d=|j	||j|jy)NrFconsoler8r)rrrir)rrr@rrr)rrrWrrrC)rDrrs   rH
test_90195zConfigDictTest.test_90195s(-$4$!*
 ""3')&!)9a.)(-.&!)rjr)Xrprqrrrsr	rrWrrrrrrrrrrrrrrrrr+rr.r/r3r6r9r=rArHrgrsrwr|rrrrrrrrrrrrrrr"rr)r,r0r4r7r:r>rBrErIrVrrequires_working_socketrZr\rerhrprurxrzr}rrrrrrrrrrrrrrtrjrHrrN	s53 / I I,9

1%".	
 !
G.9

1%".	

!%Y!

i
+G89

1%".	

'!
 !
)H89

1%"/	

!%Y!

i
+G89

1%".	

!%Y!

i
+H:9

1%".	

!%Y!

i
+H89

1/".	

!%Y!

i
+G8"77?

1%".	
%Y
!G0*?
 -/?
"?

 2%".	{

%Y
7HF9

"%55%".	

!%Y!

i
+G:9

"%55%"..

!%Y!

i
-G<9

1%".	

!%Y 

i
+G<%*9

1%".	
"%Y 

i
1G>%)9

1%".	
"%Y 

i
1H<9

1%#.	

#%Y!

h
+G6)

&!

H &

&!

H"9

*

1%".$I

!$I!
 !
7HF9

1%".	
/4

!%Y!

i
3HB
9

1%".	
/4

!%Y!

i
1H>9

1%".	
/4

!%Y!

i
3H@9

1%". "'	
 !
'H8;*N;

1%".	
 !
!H.M"
1 0:0& 



 +,#
-JB!66>!

0$!,	

. $I#0
#'#8!$99>!

0$!,	

. $I#0
#($8!$88>!

0$!,	

. $I#0
#($8 >!

0$!,	

. $I#0
#&"8 N*I6

0$!,	

. $I#0
#&"6.
9!F	

$(&& &-
&FGGF& 
&3F&< &D+&Z&(,GGJ72: ,8%W$$&'(%W$$&&'&%W$$&<,'<,|J
9E
E
E`^^B,B>))	)&/P1002F3F8*rjrceZdZdZdZy)ManagerTestcjgGfddtj}tjd}|jt|j
t|j||jd}|jdtjd|jdgy)NceZdZdfd	Zy)6ManagerTest.test_manager_loggerclass.<locals>.MyLoggerNc(j|yrr])rDrrr2exc_infoextraloggeds      rH_logz;ManagerTest.test_manager_loggerclass.<locals>.MyLogger._logs

c"rjro)rprqrrr)rsrHMyLoggerrs
#rjrrzshould appear in loggedzshould not appear in logged)
rLoggerManagerr=	TypeErrorsetLoggerClassrorrrZ)rDrmanrrs    @rHtest_manager_loggerclassz$ManagerTest.test_manager_loggerclasss	#w~~	#ood#)S%7%7=8$v&0156";!<=rjctjd}t}|j||j	|j
|yr)rrobjectsetLogRecordFactoryrZlogRecordFactory)rDrrfs   rHtest_set_log_record_factoryz'ManagerTest.test_set_log_record_factorys;ood#8)--x8rjN)rprqrrrrrtrjrHrrs> 9rjrceZdZdZdZy)ChildLoggerTestcvtj}tjd}tjd}|jd}|jd}|j|tjd|j|tjd|jd}|jd}|jd}|j|tjd|j|tjd|j||y)	Nabczdef.ghixyzzuvw.xyzdefghiabc.defzabc.def.ghi)rrgetChildr)rDrl1l2c1c2c3s       rHtest_child_loggersz"ChildLoggerTest.test_child_loggers#s


u
%


y
)
ZZ

ZZ	
"

b'++E23

b'++I67
[[

[[

[[
#

b'++I67

b'++M:;

b"rjctj}tjd}tjd}tjd}tjd}|j}||h}|j|||z|j	|||j}|j|h||j}|jt|y)Nrzfoo.barzfoo.bar.baz.bozzr{)rrgetChildrenrZassertNotInr)rDrrrl3l4kidsrfs        rHtest_get_childrenz!ChildLoggerTest.test_get_children2s


u
%


y
)


1
2


u
%}}84(?3X&~~"t$~~%rjN)rprqrrrrrtrjrHrr"s

&rjrceZdZy)DerivedLogRecordNrrtrjrHrrArrjrceZdZdZdZdZy)LogRecordFactoryTestcGddtj}tj||t|_|jj|j
tj|_	y)NceZdZdZdZy)2LogRecordFactoryTest.setUp.<locals>.CheckingFilterc||_yr)rq)rDrqs  rHrz;LogRecordFactoryTest.setUp.<locals>.CheckingFilter.__init__Hs	rjcpt|}||jurd|d|j}t|y)NzUnexpected LogRecord type z, expected T)rrqr)rDrrrs    rHrz9LogRecordFactoryTest.setUp.<locals>.CheckingFilter.filterKs5LDHH$IJ HH&C#C.(rjN)rprqrrrrrtrjrHCheckingFilterr
Gs

rjr)
rrrrIrrr1rgetLogRecordFactoryorig_factory)rDrs  rHrIzLogRecordFactoryTest.setUpFsV
	W^^
		t$%56""4;;/#779rjc|jj|jtj	|tj|jyr)r1rrrrSrrrrms rHrSzLogRecordFactoryTest.tearDownXs<%%dkk2$##D$5$56rjc|jt|jj|j	tjt|jj|j	|jdgy)N)rr}r~)
r=rr1rrnrrrrrirms rHtest_logrecord_classz)LogRecordFactoryTest.test_logrecord_class]sn)T%5%5%=%=++-	/##$45t0023!
	rjN)rprqrrrIrSrrtrjrHr
r
Ds:$7
rjr
c$eZdZdZdZdZdZdZeje
ejdddZ
eje
ejddd	Zeje
ejddd
Zy)QueueHandlerTestrctj|tjd|_tj
j
|j|_d|_t	jd|_
d|j_|jjtj|jj|jy)NrJqueF)rrIrrrr@QueueHandlerque_hdlrrFr
que_loggerrgr7rrBrms rHrIzQueueHandlerTest.setUplst[[_
((55djjA
	!++E2$)!  1""4==1rjcb|jjtj|yr)rrKrrSrms rHrSzQueueHandlerTest.tearDownvrirjc|jj|j|jtj
|jj|jj|j|jtj
|jj|j}|jj||jj
}|jt|tj|j|j|jj|j|j|j f|dfyr)rrrnr=rEmpty
get_nowaitrrrCrrrrZrFrr2)rDrrs   rHtest_queue_handlerz#QueueHandlerTest.test_queue_handlerzsd//12%++tzz'<'<=T..01%++tzz'<'<=!$zz$$&
4):):;<DOO$8$89$((DII.d<rjc|j}tjtj}d}|j	|j
||}tj|j}|jj||jj||jj}|j||j|j||j y)Nz {name} -> {levelname}: {message})rF	levelnamer)rnrrrrrFr;r<rr>rrrr rZrr)rDrr#log_format_str
formatted_msgr
log_records       rHtest_formattingz QueueHandlerTest.test_formattings!((9	;&--4998A3.P
%%doo6	

""9-$ZZ**,

7
(:(:;rj
QueueListenerz5logging.handlers.QueueListener required for this testcttj}tjj|j|}|j	|jj|j|jj|j|jj|j|j|j|jtj d|j|jtj"d|j|jtj$d|j'ttj}|j)tj$tjj|j|d}|j	|jj|j|jj|j|jj|j|j|j+|jtj d|j+|jtj"d|j|jtj$d	|j'y#|jwxYw#|jwxYw)
Nr|)rrr~rT)rrrr)rrMatcherrr@r(rrrrrnrrrrCmatchesrr}r{rKr7rW)rDrrs   rHtest_queue_listenerz$QueueHandlerTest.test_queue_listeners2goo/0##11$**gF	OO##D$5$5$78OO!!$"3"3"56OO$$T%6%6%89MMOMN

sKL0@0@#NO

goo/0))*##11$**gHL2N	OO##D$5$5$78OO!!$"3"3"56OO$$T%6%6%89MMO#NOLM0@0@#NO

-
MMO$
MMOsA;L)=A;L>)L;>Mctjj|j|j}|j	ddz|jj|jd|j|j|jjjj!dd|j|jjjj!ddy#t$r8}|}|jj|j|Yd}~d}~wwxYw)NrrrT
stack_info	TracebackStack)rr@r(rr:rZeroDivisionErrorrrrnrrrZr6rXr
r)rDrr&excs    rH&test_queue_listener_with_StreamHandlerz7QueueHandlerTest.test_queue_listener_with_StreamHandlers##11$**dnnM	I
E	
d//1dC

--/557==kJAN--/557==gFJ
!	ICOO%%d&7&7&9C%HH	IsD	E-EEc|jj|j|jj	|j
tjj|j|j}|j|jjd|j|j|jjj!dy)Nrzque -> ERROR: error)rr>r=rrBr:rr@r(rrrrrZr6rXr
)rDrs  rH*test_queue_listener_with_multiple_handlersz;QueueHandlerTest.test_queue_listener_with_multiple_handlerss	


""4#6#67""4>>2##11$**dmmLg&

--/5579NOrjN)rprqrrrWrIrSr!r'r
skipUnlessrArr@r,r5r7rtrjrHrrgs32 
=<X!1!1?CPRRBX!1!1?CPRKRKX!1!1?CPR	PR	Prjrr()patchceZdZdZdZedZeje	jjddZeje	jjddZ
edZdZd	Zy
)QueueListenerTestz~
        Tests based on patch submitted for issue #27930. Ensure that
        QueueListener handles all log messages.
        c<tjd|z}|jtjtjj|}|j
|tjj|}|j|jd|jd|jd|jd|jd|j|j||jy)z
            Creates a logger with a QueueHandler that logs to a queue read by a
            QueueListener. Starts the listener, logs five messages, and stops
            the listener.
            ztest_logger_with_id_%sonetwothreefourfiveN)
rrr7r8r@rrBr(rrrrLrK)	log_queuer\rrrs     rH
setup_and_logzQueueListenerTest.setup_and_logs&&'?%'GHFOOGMM*&&33I>Gg&''55i@HNNKKKKKK KKKKMMO  )MMOrjrVct|jD];}tj}|j	||jd|=|j
|jd|jzdyNrrz&correct number of handled log messages)rxrepeatrrrDrrZ
call_countrDmock_handlerrrCs    rH#test_handle_called_with_queue_queuez5QueueListenerTest.test_handle_called_with_queue_queuesh4;;'
H!KKM	""9A.FG
H
[33Q_E
Grjcftjt|jD][}t	j
}|j
||jd||j|j]|j|jd|jzdyrF)r*skip_if_broken_multiprocessing_synchronizerxrGmultiprocessingrrDrrKrrZrHrIs    rH test_handle_called_with_mp_queuez2QueueListenerTest.test_handle_called_with_mp_queues
>>@4;;'
(+113	""9A.FG!%%'	
(

[33Q_E
Grjc#jK		|j#tj$rgcYSwxYwwr)r rr)rCs rHget_all_from_queuez$QueueListenerTest.get_all_from_queue
s9
#..00;;
	
s30303c
6tjt|jD]}t	j
}|j
||jd|t|j|}|j|jgtjjjgg}|j!||d|Dcgc]*}t#|tj$r|j&n|,c}zycc}w)a
            Five messages are logged then the QueueListener is stopped. This
            test then gets everything off the queue. Failure of this test
            indicates that messages were not registered on the queue until
            _after_ the QueueListener stopped.
            rz&Found unexpected messages in queue: %sN)rrMrxrGrNrrDrlistrQrKrrr@r(	_sentinelrrrr)rDrrrrrfrs      rH$test_no_messages_in_queue_after_stopz6QueueListenerTest.test_no_messages_in_queue_after_stops
>>@4;;'
>'--/""5DGGIq*ABT44U;<
!!!#!1!1!?!?!I!I JK

eXF5:%<01/9G<M<M.NQUU*+&,%<=>
>%<s/Dctj}tjj	|}|j|j
|jt5|jdddy#1swYyxYwr)
rrrr@r(rrr=r_	task_done)rDrCrs   rHtest_calls_task_done_after_stopz1QueueListenerTest.test_calls_task_done_after_stop-se
I''55i@HNNMMO"":.
&##%
&
&
&s)BBN)rprqrrrsrGstaticmethodrDr9rrr@r(rKrOrQrUrXrtrjrHr;r;s	
		
	.
g&&44h	?	G
@	G
g&&44h	?
	G
@
	G
	
		>0	&rjr;ceZdZdZeZdZy)UTCctSr)ZEROrDdts  rH	utcoffsetz
UTC.utcoffset;srjcy)Nr[rtr^s  rHtznamez
UTC.tzname@srjN)rprqrrr`dstrbrtrjrHr[r[:sCrjr[ceZdZdZy)AssertErrorMessagec	|jdg|i|y#|$r%}|j|t|Yd}~yd}~wwxYw)Nrt)r=rZro)rDrrr2r3r&s      rHassert_error_messagez'AssertErrorMessage.assert_error_messageGsH	.Db24262	.Wc!f--	.sA>AN)rprqrrrgrtrjrHrereEs.rjrecPeZdZdZd
dZdZdZdZdZdZ	d	Z
d
ZdZdZ
y)
FormatterTestc	dtjtjj	ddddddddd|_d	d	d
ii|_y)Nzformatter.testrXtoz	dummy.extrzMessage with %d %s)rplaceholders)rFrpathnamelinenorrrr2customi)rr8r1rXrcommonvariantsrms rHrIzFormatterTest.setUpNsP$]]VT;?''	

$

rjNct|j}||j|j|t	j
|Sr)rrprNrqrr)rDrFrs   rH
get_recordzFormatterTest.get_record_s<dkk"MM$---.$$V,,rjcr|j}tjd}|j|j	|dtjd}|jt|j||j|jtjd}|j|jtjd}|j|jtjd}|j|jy)Nz${%(message)s}z${Message with 2 placeholders}z
%(random)s%(asctime)sz%(asctime)-15sz%(asctime)#15s
rsrr;rZrr=r_rWusesTimerCrDrrs   rHtest_percentzFormatterTest.test_percentesOO./!&FGl+*ahh2&m,

%./

%./

%rjc|j}tjdd}|j|j	|dtjdd}|jt|j|tjdd}|j|jtjdd}|j|jtjdd}|j|jtjd	d}|j|jy)
Nz
$%{message}%${r$%Message with 2 placeholders%$z{random}z	{message}	{asctime}z{asctime!s:15}z{asctime:15}rvrxs   rHtest_braceszFormatterTest.test_bracestsOOoS9!&GHj4*ahh2k5&k5

%.c:

%nC8

%rjc|j}tjdd}|j|j	|dtjdd}|j|j	|dtjdd}|j|j	|dtjdd}|jt|j||j|jtjd	d}|j|jtjd
d}|j|jtjdd}|j|jtjdd}|j|jy)N
${message}rr|zMessage with 2 placeholdersz$messagez$$%${message}%$$r}z	${random}z
${asctime}z$asctimez${asctime}--rvrxs   rHtest_dollarszFormatterTest.test_dollarss^OOl#6!&CDj4!&CD0<!&GHk5*ahh2&l#6

%j4

%l#6&nC8

%rjchtjd}|j|jdtjd}|j|jdtjd}|j|jdtjd}|j|jdtjdd}|j|jdtjdd}|j|jdtjd	d}|j|jd	tjd
d}|j|jd
tjdd}|j|jdtjdd}|j|jdtjd
d}|j|jd
tjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jdtjdd}|j|jd|j	t
tjd|j	t
tjd|j	t
tjd|j	t
tjd|j	t
tjd|j	t
tjd|j	t
tjd|j	t
tjd |j	t
tjd!|j
t
d"tjd#d|j
t
d$tjd%d|j
t
d&|j	t
tjd'd|j
t
d(tjd)d|j
t
d*tjd+d|j	t
tjd,d|j	t
tjd-d|j	t
tjd.d|j	t
tjd/d|j
t
d0tjd1d|j
t
d2tjd3d|j	t
tjd4d|j	t
tjd5d|j	t
tjd6d|j	t
tjd7d|j	t
tjd8d|j	t
tjd9d|j	t
tjd:d|j	t
tjd;d|j	t
tjd<d|j
t
d=tjd>d|j
t
d=tjd?d|j
t
d=tjd@d|j
t
d$tjdd|j	t
tjd%d|j
t
d$tjdAd|j	t
tjdBdy)CNzM%(levelname)-15s - %(message) 5s - %(process)03d - %(module) - %(asctime)*.3sz1%(asctime)*s - %(asctime)*.3s - %(process)-34.33oz%(process)#+027.23Xz
%(foo)#.*gz5$%{message}%$ - {asctime!a:15} - {customfield['key']}r{r|z{process:.2f} - {custom.f:.4f}z{customfield!s:#<30}z{message!r}z{message!s}z{message!a}z{process!r:4.2}z8{process!s:<#30,.12f}- {custom:=+#30,.1d} - {module:^30}z{process!s:{w},.{p}}z{foo:12.{p}}z{foo:{w}.6}z{foo[0].bar[1].baz}z{foo[k1].bar[k2].baz}z{12[k1].bar[k2].baz}z${asctime} - $messagerz$bar $$z	$bar $$$$z%(asctime)Zz%(asctime)bz%(asctime)*z
%(asctime)*3sz%(asctime)_r~rz
%(foo)#12.3*fz%(foo)0*.8*fz;invalid format: invalid field name/expression: 'name-thing'z{name-thing}zinvalid format: no fieldsruzinvalid conversion: 'Z'z{asctime!s:#30,15f}z7invalid format: expected ':' after conversion specifierz{asctime!aa:15}z%invalid format: bad specifier: '.2ff'z{process:.2ff}z
{process:.2Z}z{process!s:<##30,12g}z{process!s:<#30#,12g}z{process!s:{{w}},{{p}}}z1invalid format: expected '}' before end of stringz{processz7invalid format: Single '}' encountered in format stringzprocess}z{{foo!r:4.2}z
{{foo!r:4.2}}z	{foo/bar}z{foo:{{w}}.{{p}}}}z{foo!X:{{w}}.{{p}}}z{foo!a:random}z{foo!a:ran{dom}z{foo!a:ran{d}om}z
{foo.!a:d}z$invalid format: bare '$' not allowedz$bar $$$zbar $zfoo $.rzz	${asctime)rr;rZ_fmtr=r_rgrDrs  rHtest_format_validatez"FormatterTest.test_format_validates
mn!pqQR!TU34!67l+.
U]`a!XY>cJ!AB4C@!78m37/m37/m37//s;!23X`cd![\4C@!78nC80m37/33?!675SA!894C@!78
5SA!89is3+k5-	
*g&7&7G*g&7&7G*g&7&7G*g&7&7I*g&7&7G*g&7&7E*g&7&7F*g&7&7I*g&7&7H	
!!I~S	"	
	
!!'}C	"	
	
!!%	
	
*g&7&79NVYZ!!E0	"	
	
!!3/s	"	

	
*g&7&7PST*g&7&79PX[\*g&7&79PX[\*g&7&79RZ]^!!?z	"	

	
!!Ez	"	

	
*g&7&7sS*g&7&7PST*g&7&7CP*g&7&79MUXY*g&7&79NVYZ*g&7&79IQTU*g&7&79JRUV*g&7&79KSVW*g&7&7SQ	
!!4z	"	

	
!!4wc	"	

	
!!4xs	"	
	
!!'{#	"	

	
*g&7&7cR	
!!'uC	"	

	
*g&7&7CPrjcbgd}gd}t||D]\}}tj||ddi}|j}|j	|j|d|jd}|j	|j|dtj||}|j}|j
t|j
|tj||d	di}|jd}|j	|j|dy)
N)z%(custom)s %(message)sz{custom} {message}z$custom $message)%r{rroDefault)rr	z#Default Message with 2 placeholdersz 1234 Message with 2 placeholdersr|zNon-existing)r\rr;rsrZrr=r_)rDfmtsstylesrrrrs       rHtest_defaults_parameterz%FormatterTest.test_defaults_parameter/sS dF+	NJC!!#Uh	=RSA!AQXXa[*OP)AQXXa[*LM!!#U3A!Aj!((A6!!#Uni=XYA)AQXXa[*LM	NrjcR|jttjdddy)Nx)r=r_rr;rms rHtest_invalid_stylez FormatterTest.test_invalid_styleCs*g&7&7tSIrjc
|j}tjdddddddt}tj|jdj
|_d|_tjd}tj|_|j|j|d	|j|j|d
d|j||j|j d	y)Nrwrr{%(asctime)s %(message)sz1993-04-21 08:03:00,123z%Y:%dz1993:21)rsdatetimeutcrymktime
astimezone	timetuplecreatedmsecsrr;gmtime	converterrZ
formatTimerasctime)rDrr_rs    rH	test_timezFormatterTest.test_timeFsOO


tQAq!Q
<KK

d 3 = = ?@	78kka*CDa19=	$=>rjc
~Gddtj}|j}tjddddddd	t}tj|jdj|_	|}t
j|_|j|j|d
y)NceZdZdZdZy)DFormatterTest.test_default_msec_format_none.<locals>.NoMsecFormatterNz%d/%m/%Y %H:%M:%S)rprqrrdefault_msec_formatdefault_time_formatrtrjrHNoMsecFormatterrUs"&"5rjrrrwrrrrrz21/04/1993 08:03:00)rr;rsrrryrrrrrrrZr)rDrrr_rs     rHtest_default_msec_format_nonez+FormatterTest.test_default_msec_format_noneTs	6g//	6
OO


tQAq!S#
>KK

d 3 = = ?@	kka*?@rjctjddd}tdD]W}tjdtj
dd|d	zzi}|j
|}|jd
|Yy)Nz!{asctime}.{msecs:03.0f} {message}r{z%Y-%m-%d %H:%M:%S)rrri	g-C6:?rz
Message %drz.1000)rr;rxryr{rrr)rDrrrrrhs     rHtest_issue_89047zFormatterTest.test_issue_89047`sr"ESZmnt	)AJJv%%ula!e.D&EFAAWa(		)rjr)rprqrrrIrsryrrrrrrrrrtrjrHririMs?
"-
&& &*TQlN(J?
A)rjriceZdZdZdZy)TestBufferingFormattercdt|zS)Nz[(%d)r[rDrs  rHformatHeaderz#TestBufferingFormatter.formatHeaderjW%%rjcdt|zS)Nz(%d)]rrs  rHformatFooterz#TestBufferingFormatter.formatFootermrrjN)rprqrrrrrtrjrHrris&&rjrceZdZdZdZdZy)BufferingFormatterTestcjtjdditjddig|_y)Nrr>r?)rrrrms rHrIzBufferingFormatterTest.setUpqs/!!5%.1!!5%.1
rjctj}|jd|jg|jd|j|jy)Nronetwo)rBufferingFormatterrZrrrs  rHtest_defaultz#BufferingFormatterTest.test_defaultwsE&&(QXXb\*188DLL#9:rjct}|jd|j|jt	j
d}t|}|jd|j|jy)Nz[(2)onetwo(2)]z
<%(message)s>z[(2)<one><two>(2)])rrZrrrr;)rDrlfs   rHtest_customz"BufferingFormatterTest.test_custom|s`"$)188DLL+AB



/"2&-qxx/EFrjN)rprqrrrIrrrtrjrHrrps
;
GrjrceZdZdZy)
ExceptionTestcV|j}t}|j|	td#t	j
ddYnxYw|j
||j|jd}|j|jjd|j|jjd|j|jjd|j|jjd	y)
NrfailedTr/rz#Traceback (most recent call last):
z!
RuntimeError: deliberate mistakeStack (most recent call last):
z,logging.exception('failed', stack_info=True))r1RecordingHandlerrBrrrrLrKrrCexc_textrrZr0)rDrrRs   rHr'zExceptionTest.test_formattings	Q	9344	9h48			
IIaL

--/>?	@

++-AB	C//1>?	@--/?@	As	4AN)rprqrrr'rtrjrHrrsArjrceZdZdZy)LastResortTestc|j}|j|jtj}tj
}	t
j5}|jd|j|jd|jd|j|jdddddt_t
j5}|jdd}|j|j|dddt
j5}|jd|j|jddddd|j_
dt_t
j5}|jd|j|jdddd|j|j|t_|t_y#1swYOxYw#1swYxYw#1swYxYw#1swYaxYw#|j|j|t_|t_wxYw)NzThis should not appearrz
Final chance!zFinal chance!
z-No handlers could be found for logger "root"
F)r1rLr:r
lastResortrrrrrZrXrremittedNoHandlerWarningrB)rDrold_lastresortold_raise_exceptionsrrs      rHtest_last_resortzLastResortTest.test_last_resorts4>>* ++&66	;((*
Gf

34  !2B7_-  !24EF	
G"&G((*
9f_-F  !2C8
9((*
8f_-  !2B7
8
49DLL0&+G#((*
8f_-  !2B7
8
OODNN+!/G&:G#7
G
G
9
9
8
8
8
8
OODNN+!/G&:G#sm	H?A#H
'H?'4HH?72H')8H?!2H3H?
HH?H$H?'H0,H?3H<8H??3I2N)rprqrrrrtrjrHrrs#;rjrceZdZdZdZy)FakeHandlerc
NdD] }t|||j|||"y)N)rrrKr)setattrrecord_call)rD
identifiercalledres    rHrzFakeHandler.__init__s.>	PFD&$"2"2:vv"NO	Prjcfd}|S)NcHjdjy)Nz{} - {})r]r)rrmethod_namesrHinnerz&FakeHandler.record_call.<locals>.innersMM)**:{CDrjrt)rDrrrrs ``` rHrzFakeHandler.record_calls	ErjN)rprqrrrrrtrjrHrrs
Prjrc$eZdZfdZdZxZS)rc:tt|
|i|g|_yr)rrrr)rDr2r3rs   rHrzRecordingHandler.__init__s
.??rjc:|jj|y)z&Keep track of all the emitted records.N)rr]rs  rHrVzRecordingHandler.handlesF#rj)rprqrrrrVrrs@rHrrs
$rjrc|eZdZdZfdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZxZS)ShutdownTestz#Test suite for the shutdown method.ctt|g|_tj
}|j
ttd|y)Nr)rrrIrrrrr)rDraise_exceptionsrs  rHrIzShutdownTest.setUps7
lD')"22*;=MNrjcfd}|S)Ncrrt)rsrHrz'ShutdownTest.raise_error.<locals>.inners
'Mrjrt)rDrrs ` rHraise_errorzShutdownTest.raise_errors
	rjcTtd|j}td|j}td|j}ttjj
|||g}tjt|gd}|j||jy)Nrrrrx)z2 - acquirez	2 - flushz	2 - closez2 - releasez1 - acquirez	1 - flushz	1 - closez1 - releasez0 - acquirez	0 - flushz	0 - close0 - release)	rrrrrzr{r
rSrZ)rDhandler0handler1handler2r@rfs      rHtest_no_failurezShutdownTest.test_no_failuresq$++.q$++.q$++.w**Xx,JKT(^4L	
4;;/rjc$td|j}t|||j|tj
j
|g}t	jt||jd|jdy)NrrxrrJ)
rrrrrrzr{r
rSrZ)rDrerrr@s     rH_test_with_failure_in_methodz)ShutdownTest._test_with_failure_in_methodsja-!1!1%!89OO''01T(^4B8rjc0|jdtyNrrr^rms rHtest_with_ioerror_in_acquirez)ShutdownTest.test_with_ioerror_in_acquires)))W=rjc0|jdtyNrrrms rHtest_with_ioerror_in_flushz'ShutdownTest.test_with_ioerror_in_flush))'7;rjc0|jdtyNrKrrms rHtest_with_ioerror_in_closez'ShutdownTest.test_with_ioerror_in_closerrjc0|jdtyrrr_rms rHtest_with_valueerror_in_acquirez,ShutdownTest.test_with_valueerror_in_acquire	s)))Z@rjc0|jdtyrrrms rHtest_with_valueerror_in_flushz*ShutdownTest.test_with_valueerror_in_flush))':>rjc0|jdtyrrrms rHtest_with_valueerror_in_closez*ShutdownTest.test_with_valueerror_in_closerrjcFdt_|jdty)NFrrrr
IndexErrorrms rH.test_with_other_error_in_acquire_without_raisez;ShutdownTest.test_with_other_error_in_acquire_without_raises"')))Z@rjcFdt_|jdty)NFrrrms rH,test_with_other_error_in_flush_without_raisez9ShutdownTest.test_with_other_error_in_flush_without_raise"'))':>rjcFdt_|jdty)NFrKrrms rH,test_with_other_error_in_close_without_raisez9ShutdownTest.test_with_other_error_in_close_without_raiserrjcfdt_|jt|jdty)NTrrrr=rrrms rH+test_with_other_error_in_acquire_with_raisez8ShutdownTest.test_with_other_error_in_acquire_with_raises'"&*d&G&G#Z	1rjcfdt_|jt|jdty)NTrrrms rH)test_with_other_error_in_flush_with_raisez6ShutdownTest.test_with_other_error_in_flush_with_raise#'"&*d&G&G!:	/rjcfdt_|jt|jdty)NTrKrrms rH)test_with_other_error_in_close_with_raisez6ShutdownTest.test_with_other_error_in_close_with_raise(rrj)rprqrrrsrIrrrrrrrrrrrrrr
r
rrs@rHrrsY-O
0 9><<A??A??1
/
/rjrcfeZdZdZdZddZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZy)ModuleLevelMiscTestz)Test suite for some module level methods.ctjjj}|j	|d|jtj|tjd|j	tjjjd|j
ttjdGdd}|j
ttj|tjdtj|j	tjjjtjy)NrS
doesnotexistsceZdZy);ModuleLevelMiscTest.test_disable.<locals>._NotAnIntOrStringNrrtrjrH_NotAnIntOrStringr=rjrWARN)
rrrrOrZrr=r_rr{)rDold_disablers   rHtest_disablez ModuleLevelMiscTest.test_disable2sll**22a(5--55r:*gooG			
)W__6G6IJ	--55w7G7GHrjNc4gtj|tdfdt}tjj|t
t|}|||d|n	|d||jt|jd|jd}|j|jd|z||nt
t|j}|j|j||jgy)NbasicConfigc*j||fSrr)rikwrs  rH<lambda>z/ModuleLevelMiscTest._test_log.<locals>.<lambda>Lsv}}aW'=rjztest me: %rrr)
rr9rrrrBr-rZr[r
getMessageupperr)rDrer	recording
log_methodrexpected_levelrs       @rH	_test_logzModuleLevelMiscTest._test_logIs

dG]=	?%&		*Wf-
umY7}i0Y../3""1%**,mi.GH"'"3&,,.9Y8	
$rjcD|jdtjyNr)r$rr}rms rHtest_logzModuleLevelMiscTest.test_logasugmm,rjc&|jdyNrr$rms rH
test_debugzModuleLevelMiscTest.test_debugdwrjc&|jdyNrr*rms rH	test_infozModuleLevelMiscTest.test_infogvrjc&|jdyNrr*rms rHtest_warningz ModuleLevelMiscTest.test_warningjy!rjc&|jdyNrr*rms rH
test_errorzModuleLevelMiscTest.test_errormr,rjc&|jdyNrr*rms rH
test_criticalz!ModuleLevelMiscTest.test_criticalpz"rjc|jttjtGddtj
}tj||j
tj|tjtj
|j
tjtj
y)NceZdZy);ModuleLevelMiscTest.test_set_logger_class.<locals>.MyLoggerNrrtrjrHrr>vrrjr)r=rrrrrrZgetLoggerClass)rDrs  rHtest_set_logger_classz)ModuleLevelMiscTest.test_set_logger_classss)W%;%;VD	w~~		x(//18<w~~.//17>>BrjcgGfddtj}tj|tjd}|j	dgtj}tj|}|j|	|jtj|jd|j	|jjd|jd|jd|jtj |jd|j	|jd|j#||j%tjtj&y#|j#||j%tjtj&wxYw)Nc<eZdZdejffd	ZxZS)@ModuleLevelMiscTest.test_subclass_logger_cache.<locals>.MyLoggerrcHt|||jdy)Ninitialized)rrr])rDrFrrrs   rHrzIModuleLevelMiscTest.test_subclass_logger_cache.<locals>.MyLogger.__init__s u-}-rj)rprqrrrrrr)rrs@rHrrCs$.gnn
.
.rjrjust_some_loggerrEhellorr)rr?rrrZr4r5r9rBr7r8rrXr
truncaterrrLrKr)rDrrr6rRrs     @rHtest_subclass_logger_cachez.ModuleLevelMiscTest.test_subclass_logger_cachesZ	.w--/	.
	x(""#56=/2!!&)!	3OOGMM*LL!V__.446@OOAKKNOOGLL)LL!V__.3  #
GGI""7>>2
  #
GGI""7>>2sCF00AG6ctjd}td|\}}}|j}|j	d||j	d|y)Na*
            import logging

            class A:
                def __del__(self):
                    try:
                        raise ValueError("some error")
                    except Exception:
                        logging.exception("exception in __del__")

            a = A()
        -czexception in __del__zValueError: some error)rrrrrrDcodercouterrs     rHtest_logging_at_shutdownz,ModuleLevelMiscTest.test_logging_at_shutdownsR 
(d3Cjjl

,c2

.4rjcNtj}|jtj|t	j
d|d}t
d|t|d5}|j|jjddddy#1swYyxYw)Na
            import builtins
            import logging

            class A:
                def __del__(self):
                    logging.error("log in __del__")

            # basicConfig() opens the file, but logging.shutdown() closes
            # it at Python exit. When A.__del__() is called,
            # FileHandler._open() must be called again to re-open the file.
            logging.basicConfig(filename=z, encoding="utf-8")

            a = A()

            # Simulate the Python finalization which removes the builtin
            # open() function.
            del builtins.open
        rKrFrzERROR:root:log in __del__)rTESTFNrrRrrrrrZrar)rDrDrMfps    rHtest_logging_at_shutdown_openz1ModuleLevelMiscTest.test_logging_at_shutdown_opens##	(((3$*+36	 
&	t$
(W
-	NRWWY--/1LM	N	N	Ns#/BB$ctjd}td|\}}}|j}|j	d||j|dy)Nz
            import logging

            def rec():
                logging.error("foo")
                rec()

            rec()
        rKz#Cannot recover from stack overflow.r)rrrrrrZrLs     rHtest_recursion_errorz(ModuleLevelMiscTest.test_recursion_errorsU 
-T48Cjjl>DQrjctj}|jtj||j	tj|tj}|j	|||j||yr)rgetLevelNamesMappingrZr(assertIsNot)rDmappingnew_mappings   rHtest_get_level_names_mappingz0ModuleLevelMiscTest.test_get_level_names_mappingsj..0--w7--w7224+.+.rjr)rprqrrrsrr$r'r+r/r3r7r:r@rIrQrUrWr]rtrjrHrr.sN3I.%0- " #
C3>5&N>  /rjrceZdZdZdZed
dZdZdZdZ	e
jdZe
jd	Z
y)
LogRecordTestctji}t|}|j|j	d|j|jdy)Nz<LogRecord: >)rrrorCrrZ)rDrrhs   rHtest_str_repzLogRecordTest.test_str_repsD!!"%F^45

3(rjc|t}tj}|j|ddi}tjd||j|jdj||j|jdjd|j||jy)Nlessmorezless is %(less)srzless is more)rrrrBrrrr2rZrrLrK)rDrRrrs    rH
test_dict_argzLogRecordTest.test_dict_args	Q
f*A.

aiil''+1--~>			rjNctj}|t_	ddl}|jj}tj
dd|i}t
jtjdd5tj
dd|i}ddd||jjd}|t_|r|j|y|S#1swYDxYw#|t_wxYw)Nrrmsg1_rNmsg2_)processNamer1.processNamer2.processName)rlogMultiprocessingrNcurrent_processrFrr	swap_itemrPmodulesrjrO)	rrmr-prev_logMultiprocessingmprFr1r2resultss	         rH_extract_logrecord_process_namez-LogRecordTest._extract_logrecord_process_names")"<"<%7"	A(%%',,D&&se}'=>B""3;;0A4H
C**EU3%=+AB
C)-)+)+G
*AG&IIgN
C
C*AG&s$AC$:C"C$C!C$$
C1ctjdtjv}	|j	t
jdd}tji}|j	|jd|jd|}|j	d|d|j	d|d|j	d|dddl
}|j\}}|j|jd	||f
}|j|j}|jd|d|j	|d|d|j	d|d|j!|rddl
}yy#|rddl
}wwxYw)NrNTMainProcessrrjrkrlrrr)rrMrPrprZrrmrrjrvrNPipeProcessrr'assertNotEqualr)	rDmultiprocessing_importedLOG_MULTI_PROCESSINGrrurNparent_conn
child_connrs	         rHtest_multiprocessingz"LogRecordTest.test_multiprocessingsz::<#4#C  	'W77>#' %%b)AQ]]M:::1>RSG]GM,BC]G4D,EF]G4D,EF
#&:o&:&:&<#K''';;-z;A
GGI!&&(G
w}/EFW]3W=M5NO]G4D,EF
FFH(&('&(sEE??	Fc|j}|j}tji}||j||j
||j||j||jtj}tj}tj}tj}	dt_	dt_
dt_dt_tji}||j||j
||j||j||j|t_	|t_
|t_|t_y#|t_	|t_
|t_|t_wxYw)NF)
rrrrr
threadNameprocessrjtaskName
logThreadslogProcessesrmlogAsyncioTasks)rDNONENOT_NONErlog_threads
log_processeslog_multiprocessinglog_asyncio_taskss        rH
test_optionalzLogRecordTest.test_optional9sE  ''!!"%QZZ((,,
%88#33	8!&G#(G ).G&&+G#%%b)ANO!,G#0G )<G&&7G#"-G#0G )<G&&7G#s
	BF.F?cZKtji}||jywr)rrr)rD	assertionrs   rH_make_record_asyncz LogRecordTest._make_record_asyncYs"!!"%!**s)+c~	|j}tj5}dt_|j||jdt_|j||jdddtjdy#1swYxYw#tjdwxYw)NTF)	rasyncioRunnerrrrunrrset_event_loop_policyrDmake_recordrunners   rH#test_taskName_with_asyncio_importedz1LogRecordTest.test_taskName_with_asyncio_imported]s	011K!
;V*.'

;t';';<=*/'

;t'8'89:	
;
))$/

;
;
))$/s# B%AB;B%B"B%%B<c	|j}tj5}tjt
jdd5dt_|j||jdt_|j||jddddddtjdy#1swY'xYw#1swY+xYw#tjdwxYw)NrTF)rrrrrorPrprrrrrrs   rH&test_taskName_without_asyncio_importedz4LogRecordTest.test_taskName_without_asyncio_importedis	011K!
;VW->->s{{IW[-\
;*.'

;t'8'89:*/'

;t'8'89:	
;
;
))$/

;
;
;
;
))$/s; C&CAC!C)CC	CCCC6r)rprqrrrbrfrYrvrrrrrrrrtrjrHr_r_so)	0#'J8@%W$$&	0'	0%W$$&	0'	0rjr_ceZdZdZfdZfdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZej2dZddZdZdZdZdZdZ dZ!xZ"S)BasicConfigTestz#Test suite for logging.basicConfig.c|tt|tjj
|_tjj|_tjdd|_
tjj|_|j|jgtj_yr)rrrIrrr@r"r#r$r%r&rr3rcleanuprs rHrIzBasicConfigTest.setUpzsy
ot*,--
%//446")"6"6q"9&-ll&8&8#% "rjctjjddD]1}tjj||j	3t
t|yr)rrr@rLrKrrrS)rDrRrs  rHrSzBasicConfigTest.tearDownsK&&q)	ALL&&q)
GGI		ot-/rjchttjd|jtjjtjj
|j|jtjddtjj|jy)Nr@)rrrr@r"rMrNr$r&r%r7r3rms rHrzBasicConfigTest.cleanupspj$--8!  !4!45"&"9"9Qd99:rjctj|jttjj
dtjj
d}|j
|tj|j|jtj|j}|j|jjtj|j|j |j
|jtj"|jtjj$|j&y)Nrr)rrrZr[rr@rr9r6rPrrrkrBASIC_FORMATrrPercentStylerr3)rDrrs   rHtest_no_kwargszBasicConfigTest.test_no_kwargss	
W\\223Q7,,''*gw'<'<=4%%	))..0D0DE)++,i..0D0DE	
++T-H-HIrjcdtj5}tjtj
dtjdtj
jd|j|jjddddy#1swYyxYw)Nr{r6rLog an errorrERROR:root:Log an errorrrrrrPrrrrZrXr
rs  rHtest_strformatstylez#BasicConfigTest.test_strformatstylex

$
$
&	+&szz=MM.)JJOOAV__.446)
+		+	+	+BB&&B/cdtj5}tjtj
dtjdtj
jd|j|jjddddy#1swYyxYw)Nrrrrrrrs  rHtest_stringtemplatestylez(BasicConfigTest.test_stringtemplatestylerrcXd}tjdd|jttjj
dtjj
d}|j
|tjtjddd}|j|jj|jj|j|jj|jj|j|||dy)	Ncn|j|jtj|yrrrh2r5s   rHrz.BasicConfigTest.test_filename.<locals>.cleanupHHJHHJIIbMrjtest.logrF)rDrHrrrir)rrrZr[rr@rrlr6moderFrrDrrrfs    rH
test_filenamezBasicConfigTest.test_filenames	
	Z'BW\\223Q7,,''*gw':':;&&z3I,,hoo.B.BC,,hoo.B.BC(J?rjc:d}tjddtjjd}tjdd}|j|jj|jj|j|||dy)Ncn|j|jtj|yrrrs   rHrz.BasicConfigTest.test_filemode.<locals>.cleanuprrjrwbrDfilemoder)	rrrr@rlrZr6rrrs    rH
test_filemodezBasicConfigTest.test_filemodesu	
	Z$?,,''*&&z48,,hoo.B.BC(J?rjctj}|j|jt	j
||j
ttjjdtjjd}|j|tj|j
|j|y)Nrrr)
r4r5rrKrrrZr[rr@rr9r6)rDr6rs   rHtest_streamzBasicConfigTest.test_streams%6*W\\223Q7,,''*gw'<'<=0rjctjdtjjdj}|j|jjdy)Nz%(asctime)s - %(message)s)rr)rrrr@rrZrkrrDrs  rHtest_formatzBasicConfigTest.test_formatsH#>?LL))!,66	))..0KLrjctjdtjjdj}|j|jdy)Nr{)rr)rrrr@rrZrrs  rHtest_datefmtzBasicConfigTest.test_datefmts@E*LL))!,66	**E2rjctjdtjjdj}|j|jtjy)Nrr|r)rrrr@rrrkrlrs  rH
test_stylezBasicConfigTest.test_stylesF#&LL))!,66	i..0K0KLrjctjj}|jtjj|tj
d|j
tjjdtj
d|j
tjjdy)N9)r:)rrrrr7rrZ)rD	old_levels  rH
test_levelzBasicConfigTest.test_levelsyLL&&	--y9"%++R0"%++R0rjc|j}tjg}tj}|t
tjd||t
tjd||t
tj|||t
tjtjtjddy)Nr)rDr6)rDr@)r6r@)loglevelrir)r=rr9rPrr_rr)rDr=r@r6s    rHtest_incompatiblez!BasicConfigTest.test_incompatibles(())+,Z!4!4z=C	EZ!4!4z?G	IZ!4!4V?G	I	Z!4!4w||LTC8rjcBtjtjtjtjg}tj}|dj|tj||j|dtjjd|j|dtjjd|j|dtjjd|j|dj|j|dj|j|dj||j|dj|djy)Nr)r@rr)rr9rPrr;r>rrrr@rr)rDr@rs   rH
test_handlerszBasicConfigTest.test_handlers	s0!!#!!#**-!!#


  #X.

hqk7<<#8#8#;<

hqk7<<#8#8#;<

hqk7<<#8#8#;<Xa[223Xa[223

hqk++Q/

hqk++Xa[-B-BCrjctj}tj}tj|g}tj|g}tjtj
|tjdtjdtjd|jttjjdtjtj|dtjdtjdtjd|jttjjd|j|jjd|j|jjd	y)
NrrrrrT)rr@forcezWARNING:root:warnz WARNING:root:warn
INFO:root:info)r4r5rr9rrrrrrZr[rr@rrXr
)rD
old_string_io
new_string_ioold_handlersnew_handlerss     rH
test_forcezBasicConfigTest.test_forces;



--m<=--m<='//LIV

gW\\223Q7',,"&	(V

gW\\223Q7//1779,	.//1779<	>rjc	d}tjd|ddtj|jt	tj
jdtj
jd}|j|tj|j|j|tjd|jtdd	5}|jj}dddtj d|jdy#1swY1xYw#jtdd	5}|jj}dddn#1swYnxYwtj d|jdwxYw)
NrFrr%(message)srDrHerrorsrrrr.The Øresund Bridge joins Copenhagen to Malmörrrr8rZr[rr@rrlrHrrKrrar
r1rrDrHrrrs     rH
test_encodingzBasicConfigTest.test_encoding/sU	OHh'/'4GMM
K
S!6!67;ll++A.G!!'7+>+>?W--x8MMJKMMOj73
(qvvx~~'
(IIj!TM
O
(
(
MMOj73
(qvvx~~'
(
(
(IIj!TM
O0CE*D99EF?#F	F?F/F?c	d}tjd|ddtj|jt	tj
jdtj
jd}|j|tj|j|j|tjd|jtdd	
5}|jj}dddtj d|jdy#1swY1xYw#jtdd	
5}|jj}dddn#1swYnxYwtj d|jdwxYw)NrrignorerrrrrrFrz*The resund Bridge joins Copenhagen to Malmrrs     rHtest_encoding_errorsz$BasicConfigTest.test_encoding_errorsCsO	QHh'/'4GMM
K
S!6!67;ll++A.G!!'7+>+>?W--x8MMJKMMOj73
(qvvx~~'
(IIj!T#OP
(
(
MMOj73
(qvvx~~'
(
(
(IIj!T#OPrc	d}tjd|dtj|jt	tj
jdtj
jd}|j|tj|j|j||j|jdtjd|jtdd	
5}|jj}dddt!j"d|jdy#1swY1xYw#jtdd	
5}|jj}dddn#1swYnxYwt!j"d|jdwxYw)Nrrr)rDrHrrrrbackslashreplaceu<😂: ☃️: The Øresund Bridge joins Copenhagen to MalmörFrzL\U0001f602: \u2603\ufe0f: The \xd8resund Bridge joins Copenhagen to Malm\xf6)rrr8rZr[rr@rrlrHrrrKrrar
r1rrs     rHtest_encoding_errors_defaultz,BasicConfigTest.test_encoding_errors_defaultVsm	KHh'4GMM
K
S!6!67;ll++A.G!!'7+>+>?W--x8W^^-?@MMXYMMOj73
(qvvx~~'
(IIj!T$J
K
(
(
MMOj73
(qvvx~~'
(
(
(IIj!T$J
Ks0C&E EE G>F&	G&F/+/Gc$	d}tjd|ddtj|jt	tj
jdtj
jd}|j|tj|j|j||j|jgfd}||_tjd|j|jd	d|j!t#dd
5}|j%j'}dddt)j*d|jdy#1swY1xYw#j!t#dd
5}|j%j'}dddn#1swYnxYwt)j*d|jdwxYw)
Nrrrrrrc^jttjyr)r]rorPr)rrs rHdummy_handle_errorzEBasicConfigTest.test_encoding_errors_none.<locals>.dummy_handle_errorzss3==?34rjrz:'ascii' codec can't encode character '\xd8' in position 4:rFrr)rrr8rZr[rr@rrlrHrrrrrCrrKrrar
r1r)rDrHrrrrrs      @rHtest_encoding_errors_nonez)BasicConfigTest.test_encoding_errors_nonejs	(Hh'+'4GMM
K
S!6!67;ll++A.G!!'7+>+>?W--x8gnn-G
5#5GMMJKOOG$MM=>Eaj
J
MMOj73
(qvvx~~'
(IIj!T3'	
(
(
MMOj73
(qvvx~~'
(
(
(IIj!T3's0DF:F		FH3G	HG$ /Hcd}d}tdd}|jtj|	d}t	j
|d|tjd|jttjjdtjjd	}|j|tjtjd
5}d
t_|j!|dddt#|d5}|j%j'}ddd|j)d
tj*d|r|j-yy#1swYxxYw#1swYPxYw#tj*d|r|j-wwxYw)Nc6Ktjdyw)Nzhello world)rrrtrjrHr&z5BasicConfigTest.test_log_taskName.<locals>.log_recordsOOM*srztest-logging-taskname-rFrz%(taskName)s - %(message)s)rDrrHrrrrT)rrzTask-\d+ - hello world)r6rr1rrrrrZr[rr@rrlrrrrrrar
assertRegexrrK)rDr&rlog_filenamerHrrrs        rHtest_log_taskNamez!BasicConfigTest.test_log_taskNamesa	+%f.FG		<0	 Hh)1'C
E
S!6!67;ll++A.G!!'7+>+>?d+
)v*.'

:<(
)lW5
(vvx~~'
(T#<=))$/


)
)
(
(
))$/

s<B0F#"E<FF9F<FFF
F*F>cgtjfd}tjtd|t	t|}|
||dn|djdifgy)Nctjj}tjjdj	tjj|j||fy)Nd)rrrr7rr])rirrrold_basic_configrDs   rHmy_basic_configz2BasicConfigTest._test_log.<locals>.my_basic_configsR**ILL!!#&OOGLL119=MM1b'"rjrztest mert)rrrr9r-rZ)rDrerrr"rrs`    @@rHr$zBasicConfigTest._test_logsi"..	#	

dG]ODWf-
ui(y!	
2r(,rjcD|jdtjyr&)r$rrrms rHr'zBasicConfigTest.test_logsugoo.rjc&|jdyr)r*rms rHr+zBasicConfigTest.test_debugr,rjc&|jdyr.r*rms rHr/zBasicConfigTest.test_infor0rjc&|jdyr2r*rms rHr3zBasicConfigTest.test_warningr4rjc&|jdyr6r*rms rHr7zBasicConfigTest.test_errorr,rjc&|jdyr9r*rms rHr:zBasicConfigTest.test_criticalr;rjr)#rprqrrrsrIrSrrrrrrrrrrrrrrrrrrrrrr$r'r+r/r3r7r:rrs@rHrrvs-#0;J(++@$@1M3M1
9D">*O(Q&K((@%W$$& ' :-./ " #rjrcBeZdZfdZdZdZdZdZdZdZ	xZ
S)LoggerAdapterTestcDtt|tjddt|_tj|_|jj|j|j|jj|j|j|jjfd}|j||jtjtj|jd|_y)Nc,tjddyr)rr%)old_handler_listsrHrz(LoggerAdapterTest.setUp.<locals>.cleanups&6G  #rjrr)rrrIrr%rr!rrrBrrLrKr
radapter)rDrrrs  @rHrIzLoggerAdapterTest.setUps
,."//2)+llt~~.114>>B,,-	7	
 ((),,DKKtLrjcfd}d}	ddz|j	t|jjd|jjd}|j	|jtj|j	|j||j	|j|jf|j	|j|j||jfy#t$r3}|}|jj||jYd}~ d}~wwxYwNztesting exception: %rrr)r3rrr!rZr[rrrr}rr2rr
__traceback__rDrr4r&rs     rHtest_exceptionz LoggerAdapterTest.test_exceptions%	8
E
	
T^^334a8''*7S)t~~&78--c.?.?@	B!	8CLL""377	8C44	D0=(D++D0cp	ddz|jjd|jt	|j
jd|j
jd}|j|j|j||jfy#t$r}|}Yd}~d}~wwxYw)Nrrz
exc_info testr.)
r3rrrZr[r!rrrr)rDr&r4rs    rHtest_exception_excinfoz(LoggerAdapterTest.test_exception_excinfos	
E	
=T^^334a8''*--c.?.?@	B!	C	sB  	B5)B00B5cd}|jj||j|jt	|jj
d|jj
d}|j|jtj|j|j||j|j|jfy)Nzcritical test! %rrr)rrr!rZr[rrrr{rr2)rDrrs   rHr:zLoggerAdapterTest.test_criticals!c4>>2T^^334a8''*)9)9:S)t~~&78rjcb|jjjj}d|jjj_|j	t
|jjjd||j
|jjdy)N!rO )rrrrOrrrWisEnabledForrDrs  rHtest_is_enabled_forz%LoggerAdapterTest.test_is_enabled_forswll))1199.0##+!4!4!<!<i#	%22267rjcf|j|jj|jjD]}|jj||j
|jj|j
|jjyr)rCrr?rr@rLrWrts  rHtest_has_handlersz#LoggerAdapterTest.test_has_handlerss~0023{{++	/GKK%%g.	/	
00231134rjcGddtj}d}||jd}||d}d|_|j	t|t||j
tj||j|j	t|jjd|jjd}|j	|jtj|j	|jd||j	|j|jf|j}|j|j||j|jj|t!}	||_|j|j||j|j||j|jj|||_|j|j||j|j||j|jj|y#||_wxYw)	NceZdZdZdZy).LoggerAdapterTest.test_nested.<locals>.AdapterAdapterc(|jd||fSrr)rDrr3s   rHrz6LoggerAdapterTest.test_nested.<locals>.Adapter.process s++au-v55rjN)rprqrrrrrtrjrHrrsF
6rjrzAdapters can be nested, yo.rAdapterAdapterrrzAdapter AdapterAdapter )rrrrrZrrr{r!r[rrrr2rrr)rDrrradapter_adapterrorig_managertemp_managers        rHtest_nestedzLoggerAdapterTest.test_nesteds	6g++	6,D9!=!1g_(=>G,,c4>>BT^^334a8''*)9)9:'>se%DEt~~&78&..

goo|4

dkk))<8x	3&2O#MM/11<@MM'//<8MM$++--|<&2O#

o--|<

goo|4

dkk))<8'3O#s
!A%I,,	I5)rprqrrrIrrr:rrrrrs@rHrrs)M"B"B9859rjrc~eZdZfdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZxZS)
LoggerTestctt|t|_tjd|_|jj|j|j|jj|j|j|jj|jt
jy)NblahrF)
rr!rIrr!rrrrBrrLrKr
rs rHrIzLoggerTest.setUp@s
j$%')+nn&1t~~.114>>B,,-(()rjc|jtd|jjd|jtd|jjdy)Nz,Level not an integer or a valid string: Nonez.Level not an integer or a valid string: (0, 0))rr)rgrrr7rms rHtest_set_invalid_levelz!LoggerTest.test_set_invalid_levelIsJ!!EKK  $	(	
!!GKK  &	*rjcfd}d}	ddz|j	t|jjd|jjd}|j	|jtj|j	|j||j	|j|jf|j	|j|j||jfy#t$r3}|}|jj||jYd}~ d}~wwxYwr)r3rrr!rZr[rrrr}rr2rrrrs     rHrzLoggerTest.test_exceptionQs%	7
E
	
T^^334a8''*7S)t~~&78--c.?.?@	B!	7CKK!!#t~~66	7r	ctjtdd5|jt|j
jdddddy#1swYyxYw)NrTrtest message)r	swap_attrrr=rrrrms rH!test_log_invalid_level_with_raisez,LoggerTest.test_log_invalid_level_with_raisebsJ


w(94
@	Pi$O	P	P	Ps-AActjtdd5|jj	dddddy#1swYyxYw)NrFrr))rr*rrrrms rHtest_log_invalid_level_no_raisez*LoggerTest.test_log_invalid_level_no_raisefs<


w(95
A	2KKOOD.1	2	2	2sAAcgtj|tjdfd|jjd|j
td|j
ddy)Nprint_stackcBj|jSr)r]rX)rrrs  rHrz=LoggerTest.test_find_caller_with_stack_info.<locals>.<lambda>msfmmDMMO&DrjTr/rrr)rr9r	tracebackr
findCallerrZr[)rDrs @rH test_find_caller_with_stack_infoz+LoggerTest.test_find_caller_with_stack_infojsd

dG--}D	F	
$/Va(;VAYGrjcd|jjfdfdfd}|jj}||j	|dj
d|dj}dz
||j	|dj
d|j|dj||dj}dz
||j	|dj
d|j|dj||dj}tj}|j|jtj||j	|dj
d|j|j|jjdz
||j	|dj
d	|j|dj|y)
Nrcdy)Nr)
stacklevelrt)	the_leveltriggersrH	innermostz>LoggerTest.test_find_caller_with_stacklevel.<locals>.innermostxs
Fy1rjcyrrt)r9srHrz:LoggerTest.test_find_caller_with_stacklevel.<locals>.inner{sKrjcyrrt)rsrHouterz:LoggerTest.test_find_caller_with_stacklevel.<locals>.outer~sGrjrJr9rr< test_find_caller_with_stacklevel)rrr!rrZrrnrrrrBrL)	rDr<rrnr1rr9r7r8s	     @@@@rHr=z+LoggerTest.test_find_caller_with_stacklevelts	++%%	2		..((
--{;##Q	
--w772;--v6##Q	
--w772;--v6##'')t~~.//
--w7!!$..1++%%Q	
--/QR72;--v6rjc(d}d}dx}x}x}x}x}x}}	tj|||||||||		}
dt|
jj	zD]:}|di}|jt|jj|||||||||	<y)N	my record
)rr
some valuersinfo)	r_logRecordFactoryr___dict__keysr=rr
makeRecord)
rDrFrr5lnorr2rrrCrvrrs
             rH%test_make_record_with_extra_overwritez0LoggerTest.test_make_record_with_extra_overwrites:>>>S>3>>>4%

&
&tUBS$'/u>*E"++2B2B2D,EE	8C,'Eh(>(>e #sD($)

8	8rjcd}d}dx}x}x}x}x}x}}	ddi}
|jj||||||||
|		}|jd|jy)Nr?r@	valid_keyrArB)rrGrrE)rDrFrr5rHrr2rrrCrrs            rH(test_make_record_with_extra_no_overwritez3LoggerTest.test_make_record_with_extra_no_overwritesx:>>>S>3>>>4%l+''eRc4(0U(L

k6??3rjc|j|jj|jjD]}|jj	||j|jjyr)rCrr?r@rLrWrts  rHrzLoggerTest.test_has_handlerssa//12{{++	/GKK%%g.	/0023rjcztjd}d|_|j|j	y)Nz
blah.childF)rrrgrWr?)rDchild_loggers  rHtest_has_handlers_no_propagatez)LoggerTest.test_has_handlers_no_propagates1((6!&1134rjc&|jjj}d|jj_|jt|jjd||j|jj
dy)NrO)rrrOrrrWrrs  rHrzLoggerTest.test_is_enabled_forsbkk))11&(#!4!4iM11"56rjc|jj}|jjj}d|j_d|jj_|j	t
|jd||j	t
|jjd||j
|jjdy)NTrrrOrT)rrrrOrrrWr)rDold_disabledrs   rH#test_is_enabled_for_disabled_loggerz.LoggerTest.test_is_enabled_for_disabled_loggers{{++kk))11#&(#j,G!4!4iM11"56rjctj}|j|tj|j|tjd|j|tjd|j|tjd|j|tjdj|j|tjdj|j|tjdj|j|tjd|j|tjdjy)Nrrrzr)rrrrrrZ)rDrs  rHtest_root_logger_aliasesz#LoggerTest.test_root_logger_aliasess  "

dGLL)

dG--d34

dG--b12

dG--f56

dG--e499:

dG--i8==>

dG--e4;;<w0067w00;BBCrjc|jttjt|jttjdy)Nsfoo)r=rrranyrms rHtest_invalid_nameszLoggerTest.test_invalid_namess2)W%6%6<)W%6%6?rjcttjdzD][}dD]T}tj|}tj
||}tj|}|j||V]y)Nr)rrrzrzbaz.bar)rxr*HIGHEST_PROTOCOLrrrYr+r)rDprotorFrrh	unpickleds      rH
test_picklingzLoggerTest.test_picklingsk622Q67	1EA
1 **40LL/"LLO	

i0	
1	1rjcn
|j}tjd}tjd}|jtj|j|j
tj|j|ji|j|jtj|j|jtj|j|jtjdtjdi|j|ji|j|jtj|j|ji|j|jtj|j|jtjdi|jtj|j|j
tj|j|ji|j|jtj|jtj|j|j
tj|j|ji|j|ji|j|ji|j|jtj|j|jtj|j|jtj|j|jtj|j|jtjtj|j|j
tj|j|ji|j|ji|j|ji|j|jtj|j|jtj|j|jtjy)NrrTF)r1rrr7r}rZr2_cacherCrrWr8r{rrO)rDrr/r0s    rHtest_cachingzLoggerTest.test_cachingsz##E*##I.	


gmm$224gmmD,	
,,W]];<--gmm<='--w}}e)TUb),,W]];<	
b)))'--89w}}d&;<	))*224g6F6FG,	
--gmm<=	(224g6F6FG,,b)	
--gmm<=,,W-=-=>?--gmm<=,,W-=-=>?))'--89	224g6F6FG,,b)	
--g.>.>?@--g.>.>?@**7+;+;<=rj)rprqrrrIr&rr+r-r3r=rJrMrrQrrWrZr]rbrerrs@rHr!r!>s^**B"P2H%7N8445
7
7D@16>rjr!c(eZdZdZdZdZdZdZy)BaseFileTestz1Base class for handler tests that write log filesc^tj|tdd|_g|_y)Nrztest_logging-2-)rrIr6r5rmfilesrms rHrIzBaseFileTest.setUp$s$t ):;rjc
|jD]}tj|tjj	|j
rtj|j
tj|yr)rir1rRrXrYr5rrS)rDr5s  rHrSzBaseFileTest.tearDown)sR,,	BIIbM	
77>>$''"IIdgg$rjc|jtjj|d|z|jj|y)z7Assert a log file is there and register it for deletionzLog file %r does not existrN)rCr1rXrYrir])rDrDs  rH
assertLogFilezBaseFileTest.assertLogFile0s=x088C		EH%rjc
rtjdtjdd|jdddS)Nrqrr)rrr8rnrms rHnext_reczBaseFileTest.next_rec6s5  gmmS!!%!2!2!4dD$H	HrjN)rprqrrrsrIrSrmrortrjrHrgrg!s7
 &HrjrgceZdZdZdZy)FileHandlerTestc:tj|jtj|jdd}|j|j|jtjj|j|jtji|j|j|jtjj|j|jy)NrFTrG)r1rRr5rrlrr6rWrXrYrVrrrCrK)rDfhs  rH
test_delayzFileHandlerTest.test_delay;s
		$''

 
 7$
G"))$01
		'''+,RYY'tww/0

rjctj|jtj|jdd}|jtjd|j|j|j|j|jt|j5}|j|jjddddy#1swYyxYw)NrFrh)rHrrr|)r1rRr5rrlr>r;r?rorKrrZrar
)rDrsrTs   rH%test_emit_after_closing_in_write_modez5FileHandlerTest.test_emit_after_closing_in_write_modeEs
		$''

 
 7
E
))-89


 




 
$'']	5bRWWY__.4	5	5	5s	/DD
N)rprqrrrtrvrtrjrHrqrq:s	5rjrqceZdZejejddZdZdZ	dZ
dZejdZ
y)	RotatingFileHandlerTestWASI does not have /dev/null.ctjj|jdd}|j	|jd|j
tjjtjdd}|j	|j|j|j
y)NrFrrHmaxBytesr)
rr@rmr5rWshouldRolloverrKr1devnullrorDrhs  rHtest_should_not_rolloverz0RotatingFileHandlerTest.test_should_not_rolloverQs


1
1'A27**401




1
1

Wq2:**4==?;<

rjctjj|jdd}|j	|j|j
|jy)NrFrr{)rr@rmr5rCr}rorKrs  rHtest_should_rolloverz,RotatingFileHandlerTest.test_should_rollover`sJ



1
1$''GVW
1
X))$--/:;

rjctjj|jd}|j	|j|j
|j|jy)NrFr)rr@rmr5r?rormrKrs  rHtest_file_createdz)RotatingFileHandlerTest.test_file_createdesP


1
1$''G
1
L


 477#

rjcd}tjj|jddd}||_|j|j
|j|j|j|j
|j||jdz|j|j
|j||jdz|jtjj||jdz|jy)	Nc|dzSN.testrtr$s rHnamerz>RotatingFileHandlerTest.test_rollover_filenames.<locals>.namerns'>!rjrFrrrHbackupCountr|.1.2.3)
rr@rmr5rr?rormrWr1rXrYrK)rDrrs   rHtest_rollover_filenamesz/RotatingFileHandlerTest.test_rollover_filenamesms	"



1
1GGg1q2B


 477#


 5401


 5401dggn(=>?

rjcGddtjj}||jddd}|j	|j|j|jdz|j
|j|j|j|j
|j|j|j|jdzd	z|jtjj|j|jdz|jy)
NceZdZdZdZy)ZRotatingFileHandlerTest.test_namer_rotator_inheritance.<locals>.HandlerWithNamerAndRotatorc|dzSrrt)rDrFs  rHrz`RotatingFileHandlerTest.test_namer_rotator_inheritance.<locals>.HandlerWithNamerAndRotator.namer~sg~%rjcvtjj|rtj||dzyy)N.rotated)r1rXrYr)rDsourcedests   rHrotatorzbRotatingFileHandlerTest.test_namer_rotator_inheritance.<locals>.HandlerWithNamerAndRotator.rotators*77>>&)JJvtj'89*rjN)rprqrrrrrtrjrHHandlerWithNamerAndRotatorr}s
&
:rjrrFrrrrrr)rr@rmr5rZrr?rormrWr1rXrYrK)rDrrs   rHtest_namer_rotator_inheritancez6RotatingFileHandlerTest.test_namer_rotator_inheritance|s	:)9)9)M)M	:(GGg1qB$''*DGGg,=>


 477#


 288DGGdN3j@A4(@AB

rjcd}d}tjj|jddd}||_||_|j
}|j||j|j|j
}|j|||jdz}|j|tj}t|d5}|j}	tj|	}
|j|
j!d	|j"|zddd|j|j
||jd
z}|j|t|d5}|j}	tj|	}
|j|
j!d	|j"|zddd|j|j
||jd
z}t|d5}|j}	tj|	}
|j|
j!d	|j"|zddd|j%tj&j)||jdz|j+y#1swYxYw#1swYxYw#1swYuxYw)Nc|dzS)Nz.gzrtr$s rHrz3RotatingFileHandlerTest.test_rotator.<locals>.namers%<rjc t|d5}|j}tj|d}t|d5}|j	|ddddddtj|y#1swY'xYw#1swY+xYw)Nrbrnr)rrazlibcompressrr1r)rrsfr
compresseddfs      rHrz5RotatingFileHandlerTest.test_rotator.<locals>.rotatorsyfd#
)rwwy!]]43
$%)HHZ()
)

IIf))
)
)s#3BA8B8B	=BB
rFrrrrrrrr)rr@rmr5rrror?rmr1lineseprrar
decompressrZrrrWrXrYrK)rDrrrm1m2r5newlinerrrs           rHtest_rotatorz$RotatingFileHandlerTest.test_rotatorsV	 	


1
1GGg1q2B

]]_
477#
]]_

477T>
"2**
"d^	EqJ??:.DT[[1266G3CD	E	

 
477T>
"2
"d^	EqJ??:.DT[[1266G3CD	E	

 
477T>
"
"d^	EqJ??:.DT[[1266G3CD	E	
dggn(=>?

%	E	E	E	E	E	Es'!AKAK%*AK2K"%K/2K;N)rprqrrrrris_wasirrrrr
requires_zlibrrtrjrHrxrxPsZX__W__&EFG

&W**rjrxcpeZdZejejddZdZdZ	dZ
dZdZy)	TimedRotatingFileHandlerTestryctjjtjddd}tjdtjddi}|j|j||jy)NSrFrrHr皙?rztesting - device file)rr@rnr1r~ryr{rrWr}rK)rDrsrs   rHrz5TimedRotatingFileHandlerTest.test_should_not_rolloversp


6
6

C'q7B

3!!5*A"BC**1-.

rjctjj|jddd}tjd}|j|tjddi}|j||j|jtjdtjdd	i}|j||jd
}tjj}d}t|D]w}|tj|z
}	|j|	j!d
z}
t"j$j'|
}|s\|j(j+|
nd|z}|st"j$j-|j\}}
t#j.|D
cgc]}
|
j1|
s|
}}
t3d|j!dzt4j6t3d|zt4j6|D]^}
t3d|
zt"j$j9||
}t;|d5}t3|j=ddd`|j?||ycc}
w#1swYxYw)NrrFrrrrztesting - initialrztesting - after delayFi,secondsz.%Y-%m-%d_%H-%M-%Sz,No rotated files found, went back %d secondsz
Test time: %sz%Y-%m-%d %H-%M-%SrzThe only matching files are: %szContents of %s:rrl) rr@rnr5r;r>rr?rmryr{rKrr:rx	timedeltastrftimer1rXrYrir]rlistdirrrrPrrrrarC)rDrsrrsrtfoundr:GO_BACKsecsprevr5rdnrfilesrXtfs                 rH
test_rolloverz*TimedRotatingFileHandlerTest.test_rollovers5



6
6wA7? 9:


"
"E+>#?
@
477#

3

"
"E+B#C
D


##%'N	D++D99D4==)=>>BGGNN2&E##B'
	=wFWW]]477+FB "

2C1!,,r2BQCEC/CLL1D$EECJJW3e;#**M
%'!+,ww||B*$_%"'')$%%
%
	
3'D%%sJ5-J5=J::K	cT|j}|ttjj|j
ddd|ttjj|j
ddd|ttjj|j
dddy)NXrFTrGWW7)r=r_rr@rnr5)rDr=s  rHtest_invalidz)TimedRotatingFileHandlerTest.test_invalids((Z!1!1!J!JWWcG4	AZ!1!1!J!JWWcG4	AZ!1!1!J!JWWdWD	Brjc	d}tjddd}tjj	|j
ddddd|}	|j
|}|j||dz|j
|d	z}|j||d
z|jy#|jwxYw)NrrFMIDNIGHTrTrHwhenintervalrratTimeжi@)	rryrr@rnr5computeRolloverrZrK)rDcurrentTimerrres     rH"test_compute_rollover_daily_attimez?TimedRotatingFileHandlerTest.test_compute_rollover_daily_attimesr1a(



6
6GGgJPQV7%	''4FV[<%?@''l(BCFV[<%?@HHJBHHJs
AB++B=c
Vttj}||dzz
}tjddd}tj|j}tdD]*}tjj|jdd|zddd|	}	||kDr	d|z
|z}n||z
}|dz}|d
z
}||z
}|j|}||k7r2tdtjztdtz|j||||k(r|d
z
}|j|dz}||k7r2tdtjztdtz|j|||j-y#|jwxYw)NQrrrFzW%drTrrzfailed in timezone: %dzlocal vars: %si:	r)roryrrtm_wdayrxrr@rnr5rrtimezonelocalsrZrK)	rDrtodayrwdaydayrrfres	         rH#test_compute_rollover_weekly_attimez@TimedRotatingFileHandlerTest.test_compute_rollover_weekly_attimes$))+&kE11r1a({{5!))8	C!!::'aUV;)B
#:!"D3H #d
HL(L(E!++E2X%2T]]BC*VX56  2$; 00H++EL,@AX%2T]]BC*VX56  2
?	>
s
C#FF(ctjd}|jtj|g}t
j
j
}tdD];}|j|jd|tjdz
}=d}g}g}|D]}tjj|d|z}	tjj!|	d	dd
d}
|j|
|j#d
r|D]}|j|d|d|
_|D]}|j|d|d|D]8}tjj||}	t'|	d5}
	ddd:t)|D]#\}}||}
|
j+}|j-t/|d|j#d
rOd|z}	|D]D}tjj1|\}}|j3|j#|	F|D]}tjj1|\}}|j3|j5d|j3|j#|dzxr|t/|dzj7&y#1swYxxYw)Nrrrbz%Y-%m-%d_%H-%M-%Srr)a.bza.b.czd.ezd.e.fz%s.logrhrT)rrrrIrz.log.c,|jdddzS)Nrr)rr$s rHrzKTimedRotatingFileHandlerTest.test_compute_files_to_delete.<locals>.<lambda>JsT\\&"-E-Nrjrrrrz%s.log.r)r/mkdtemprshutilrmtreerr:rxr]rrr1rXrrr@rnrrr	enumerategetFilesToDeleterZr[rrCrZisdigit)rDwdtimesr_rrprefixesrrotatorsrrrrr5r
candidatesrrs                 rHtest_compute_files_to_deletez9TimedRotatingFileHandlerTest.test_compute_files_to_delete3s


_
5

r*



"
"
$r	0ALL%89:($$Q//B	04
	<FRF!23A&&??IJLMFJ@LG
OOG$  '<ALL!:;<!O
<ALL!:;<
	<	BR$Aa
!

	
#8,	CIAvqkG 113JS_a0  '&#6AGGMM!,EArOOBMM!$456$CAGGMM!,EArOOBKK$78OOBMM&3,$?%B$&s6{Q$7$?$?$ACC	C

sK

K	N)
rprqrrrrrrrrrrrrrtrjrHrrsDX__W__&EFG((TB
 &P.CrjrcZtjdi|tjdzS)Nrrrt)rr)rs rHrrds&##x'9'9!'DDDrj)rr)M<)Hi)Dr)rrW0rw)dayshoursctjj|jd|ddd}d}|j	|}||k7r=|dk(r7	|j
rt
j|}nt
j|}|d}|d	}|d
}	tjj|dz|zdz|	zz
}
||
z}td|d
|j
dtjtd|ztjtd|ztjtd|	ztjtd|
ztjtd|ztj|j|||jy#t$r(}td|ztjYd}~Od}~wwxYw)NrFrrT)rHrrrrgrrrwrrzt: z ()rzcurrentHour: %szcurrentMinute: %szcurrentSecond: %szr: %sz
result: %sz exception in diagnostic code: %s)rr@rnr5rrryr	localtime	_MIDNIGHTrrPrrrZrK)
rDrexprrrercurrentHour
currentMinute
currentSecondrrr&s
             rHtest_compute_rolloverros



6
6GGgD1!QU7W##K0&=z!Svv KK4 NN;7"#A$K$%aDM$%aDM((22{R7G7D8EHJ7K)7*+A)1_F!RVV43::F+k9

K-
=CJJO-
=CJJO'A+CJJ7,/cjjA	
f%

!S<q@szzRRSsD6F))	G2GGztest_compute_rollover_%sz>win32evtlog/win32evtlogutil/pywintypes required for this test.ceZdZdZy)NTEventLogHandlerTestcd}tjd|}tj|}	tjjd}tjddi}|j||j|j|tj|tjtj z}d}d}	tj"|||	}
|
D]1}|j$dk7rt'j(||}|d	k7r/d
}nd|	z}|j+||y#tj$r*}|jdk(rtjdd}~wwxYw)
NApplicationtest_loggingrz#Insufficient privileges to run testrzTest Log MessageFrzTest Log Message
Tz3Record not found in event log, went back %d recordsrl)win32evtlogOpenEventLogGetNumberOfEventLogRecordsrr@NTEventLogHandler
pywintypesrwinerrorrSkipTestrrVrK
assertLessEVENTLOG_BACKWARDS_READEVENTLOG_SEQUENTIAL_READReadEventLog
SourceNamewin32evtlogutilSafeFormatMessagerC)rDlogtypeelhnum_recsrRr&rflagsrreventsrs            rHr[z NTEventLogHandlerTest.test_basicsY&&tW599#>	  22>BA
!!5*<"=>			+"H"H"MN33445))#ug>	A||~-!33Aw?C,,E	DgM3'1	zzQ''(MNN	sD66E3	%E..E3N)rprqrrr[rtrjrHrrs(rjrceZdZdZy)MiscTestCasecDhd}tj|t|y)N>rrFiltererr
RootLoggerrPlaceHolderrcurrentframerStrFormatStylerrmrl)not_exported)rcheck__all__r)rDrs  rHtest__all__zMiscTestCase.test__all__s,
	T7FrjN)rprqrrr rtrjrHrrsGrjrcVtjtjddy)NLC_ALLr)renterModuleContextrrun_with_localertrjrHsetUpModuler%s 7 7" EFrj__main__r)F)rsrlogging.handlerslogging.configrrr#rrjr*r4rrrXr1rr|rUrrr(rPr/test.support.script_helperrrrrtest.supportrrrr	r
test.support.logging_helperrrrrryrrrzhttp.serverrr
urllib.parserrsocketserverrrrrrrrrrrrrTestCaserrvrSILENTrTERSEEFFUSIVErr	TALKATIVEr
CHATTERBOXBORINGrxrrrrrrr6r8rrr9rrrrrrr
r)r7rArErJrrrLr`r;rrrrr8r=rCrNrRr`IPV6_ENABLEDrcrirrrrrrrr@r(rrrrrrrrrrr
rrN
unittest.mockr9r;rr]tzinfor[rrerirrrrrrrrrrr_rrr!rgrqrxrrrrrrrrr%rpmainrtrjrH<module>r:s!"

			
	



N"&)(!3:+DDX633	
j'x  j'ZUIUIn<%h<%L		
FFQJ'(*	'**)
+
+,
(+gnn+::C'C'LS2(S2l11#--#

'@'@XG;U%%G;T060d'\:'R1L"41>-L"4-^69(}(((
!  ",,,.h/#@C5C5L-**-
aXaH!  ",,,.W+W+/#W+tWVY/1HI&-&J&!  ",,,.>:(>:/#>:@WVY/1HI(1(J(!  ",,,.IBIB/#IBVWVY/1HI&-&J&]//;=
6-
6=
6!  ",,,.K hK /#K Z11h-L8-L`%K8%KP.

#	G))		W%%33		%++	{*X{*z-9(9.&h&>	w((	 8 F-,,.iPxiP/iPV7_-#0002]&H]&3]&@x!(//
e..Y)H%%'9Y)x&W77&GX..G&AHA,$;X$;N		$w**$T/8T/nx/(x/vJ0HJ0ZY#h''Y#x
i9))i9X`>-`>FH8H25l5,jljXeC<eCPE %,1B/0
)dID#*.3 B(*Dt*KMbcS)dX["bc (H (d (FG8$$GGzHMMOO|
6155K5/J6
		s0[&['3[9[$'[65[69\\