python (3.12.0)

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

ΑeV	ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZddlmZddlmZddlmZddlmZddlmZddlm Z dd	l!m"Z"ddl#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddl(Z(ddl)Z)dd
l*m+Z+m,Z,ddl-m.Z.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4e(jj5d
dl6m7Z7ddd	ddl8Z8ddl9Z9ddl:Z:	ddl<Z<Gdde'jzZ>Gdde>Z?Gdde>Z@dZAdZBdZCdZDdZEdZFdZGdZHdZIdZJeKeJeAd
zZLeAdeBd eCd!eDd"eEd#eFd$eGd%eHd&eId'eJd(i
ZMGd)d*ejZOGd+d,ejZPGd-d.e>ZQd/ZRGd0d1e>ZSGd2d3eTZUGd4d5ejZWGd6d7eTZXGd8d9e>ZYGd:d;e7jZ[Gd<d=eTZ\Gd>d?e\e+Z]Gd@dAe\e3Z^GdBdCe\e1Z_e`edDrGdEdFe^ZaGdGdHe_ZbejejGdIdJe>ZeGdKdLe>ZfGdMdNejZhdOZiGdPdQe>ZjejejGdRdSe>Zke'je`edDdTGdUdVekZmejejGdWdXe>Zne'je`edDdTGdYdZenZoejejGd[d\e>Zpe'je`edDdTGd]d^epZqe'jejd_Gd`daepZsejejGdbdce>ZtGdddee>ZuGdfdge>ZvGdhdie>ZwddjZxGdkdlZydmZzGdndoejZ{GdpdqejjZ~GdrdsejZdtZdduZGdvdwe>ZGdxdye>ZGdzd{e>ZGd|d}ejZGd~de>ZejGdde>Ze`ejdr)ddlZddlmZejGdde>ZejdZGddej ZeZGddZGdde'jzeZGddej*ZGdde'jzZGdde>ZGdde>ZGddZGddej6ZGdde>ZGdde>ZGdde>ZGdde'jzZGdde'jzZGdde>eZGdde>ZGddeZGddeZGddeZdZddddddeddffD]\ZZeefdZeedezee'je8dGdde>ZGdde'jzZdZedk(re'j`yy#1swYxYw#e;$r
dxZ8xZ9Z:YwxYw#e;$rY	wxYw)N)assert_python_okassert_python_failure)support)	os_helper)
socket_helper)threading_helper)warnings_helper)asyncore)TestHandler)
HTTPServerBaseHTTPRequestHandler)urlparseparse_qs)ThreadingUDPServerDatagramRequestHandlerThreadingTCPServerStreamRequestHandler)smtpdc4eZdZ	dZdZdZdZdZd	dZdZ	y)
BaseTestz&%(name)s -> %(levelname)s: %(message)sz^([\w.]+) -> (\w+): (\d+)$rc	tj|_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)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	9.>>@'')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)Nr) 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.J6J66KNc	|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)Nz*Log line does not match expected pattern:
z'Remaining output at end of log stream:
)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
cL	|xjdz
c_d|jzS)Nrz%d)message_numrDs rHnext_messagezBaseTest.next_messages)	Ad&&&&rjNN)
__name__
__module____qualname__r<rWrlrIrSrirnrjrHrrOs-'9J4K(4T ADF$'rjrc8eZdZ	dZdZdZdZdZdZdZ	y)	BuiltinLevelsTestc|j}tjd}|jtjtj
tjdi}|jtjtjd}|jtj|jtj||j||jtj||j||j||j||jtj||j||j||j||j||j||j||j||j||jgdy)NERRINFDEB))rwCRITICAL1)rwERROR2)rxrz3)rxr|4)rxWARNING5)rxINFO6)ryrz7)ryr|8)ryr9)ryr10)ryr811)rnrrr7r|
LoggerAdapterrr8logrzerrorwarninginfodebugri)rDmrwrxrys     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)NrxINF.ERR)rrzr{)rr|r}
rnrrr7rr|rrzrrrrri)rDrrxINF_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)Nrxr	INF.UNDEF
INF.ERR.UNDEFUNDEF))rrzr{)rr|r})rrr~)rrr)rrzr)rr|rr)rDrrxr	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)NrxINF.BADPARENT.UNDEF
INF.BADPARENT))rrzr{)rrr})rrzr~)rrr)
rnrrr7rrFATALrrri)rDrrx
GRANDCHILDCHILDs     rHtest_nested_with_virtual_parentz1BuiltinLevelsTest.test_nested_with_virtual_parent(s&&&'<=
!!/2W\\"	w}}ac*
		'--%

13	
AC
	rjc	|jtjdtj|jtjtjdy)Nr)rZrgetLevelNamerrms rHtest_regression_22386z'BuiltinLevelsTest.test_regression_22386BsC4--f5w||D--gll;VDrjcntjd}|j|tjy)Nr)rrrZr)rDfatals  rHtest_issue27935z!BuiltinLevelsTest.test_issue27935Gs&$$W-

.rjc	tjtjd|jtjtjd|j	tj
tjd|j	tj
tjd|j	tj
dtjy)NrrNOTSET)raddLevelNamer
addCleanuprZrrrms rHtest_regression_29220z'BuiltinLevelsTest.test_regression_29220Ks4W\\2.,,gllFC--gll;R@--gnn=xH--h7HrjN)
rprqrrrrrrrrrrsrjrHrurus,4-^.!F4E
/Irjruc eZdZ	dZdZdZy)BasicFilterTestctjd}|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)rprqrrrrrrsrjrHrrSs(*0-:%rjrxwvutsrqpoSilentTaciturnTerseEffusiveSociableVerbose	Talkative	Garrulous
ChatterboxBoringceZdZ	dZy)GarrulousFilterc(|jtk7SN)levelno	GARRULOUSrDrs  rHrzGarrulousFilter.filters~~**rjNrprqrrrrsrjrHrrs
3+rjrceZdZ	dZy)VerySpecificFilterc2|jttfvSr)rSOCIABLETACITURNrs  rHrzVerySpecificFilter.filters~~h%999rjNrrsrjrHrrs
?:rjrc<eZdZ	dZdZdZdZdZdZdZ	dZ
y	)
CustomLevelsAndFiltersTest^[\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)rprqrrrWrIrrrrr!r,rsrjrHrrs2J3'
1@8*"B ('rjrc`tj|i|\}}tj||Sr)tempfilemkstemposrK)argskwargsfdfns    rHmake_temp_filer5Ls+


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-8TencodingdelayrTestrDz/var/run/syslogz/dev/log)GETPOSTPUTrM	localhostz/logrr)sysplatformr5r0unlinkrr@WatchedFileHandlerdevinorZrhandleassertFalsepathexistsrCrK
SysLogHandlerfacilityLOG_USER
unixsocketOSErrorr<
ValueErrorHTTPHandlerBufferingHandlershouldFlush)	rDexistingr4rRrSrTrsocknamemethods	         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)NwarRrBrGrE)r5r0rQpathlibPathrFileHandlerr@RotatingFileHandlerTimedRotatingFileHandlerrOrPrRrCrWrXrK)rDr4pfncasesclsr1rRs       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)	ranger0rQtime
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-targetr1TrErFz'%(asctime)s: %(levelname)s: %(message)s{Gzt?rtestingzDeleted at z, opened at )handle_timeryr5	threadingThreaddaemonstartrr@rRr;r>rwrxrzrrU	ExceptionprintrrKr0rWrXrQ)rDr	del_count	log_countrHr4removerrRrrrs`          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&0FFAG0cJ	Gddtj}|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)
Nc$eZdZfdZdZxZS)AHandlerTest.test_post_fork_child_no_deadlock.<locals>._OurHandlercpt|tjt	ddd|_y)Nz	/dev/nullwtrErGr6)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/)exitcode)rr;rZr[r"rrr6rKrF
assertGreater_at_fork_reinit_lock_weaksetrrBr7r8rEventrrrr0forkr_exitrrrwait_process)	rDrtest_loggerrlock_holder_threadpidrrrs	      @@@rHrz,HandlerTest.test_post_fork_child_no_deadlocks	M	/'//	/	
W../3-++22889C3w001153wCCDaH''(JKw'W]]+$-OO$5!6?oo6G3	'2'--,CE	  "!&&(ggi!8
  !GH
FG7;;=##%  q1sHH"N)rprqrrr@rerqunittestskipIfr0rFr
is_emscriptenrrequires_working_threadingrequires_resourcer
requires_forkrrsrjrHr7r7Rs=3j,X__RWW_&WXX__H1002Wz*)"+3Y)"^W0002H23H2rjr7ceZdZdZy)	BadStreamctd)Ndeliberate mistake)RuntimeError)rDdatas  rHwritezBadStream.write)s/00rjN)rprqrrrrsrjrHrr(s1rjrceZdZdZy)TestStreamHandlerc||_yr)error_recordrs  rHhandleErrorzTestStreamHandler.handleError-s
"rjN)rprqrrrrsrjrHrr,s#rjrc(eZdZejZdZy)StreamWithIntNamerN)rprqrrrrlevelrFrsrjrHrr0s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)rrrrraiseExceptionsrUassertIsrr9rcaptured_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
EcB	tj}tj}|j	|}|j|tj|j	|}|j|||j	|}|j|yr)	rr9r4r5	setStreamrrOrassertIsNone)rDrRr6oldres     rHtest_stream_settingz%StreamHandlerTest.test_stream_settingKsz	
!!#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)rprqrrrrrrsrjrHrr4s0,"@rjrc,eZdZ	dZdZdZdZdZy)TestSMTPServerctjj||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||||yr)r)rDpeermailfromrcpttosrs     rHprocess_messagezTestSMTPServer.process_message~s		


dHgt4rjc	tj|j|jfx|_}d|_|j
yNrTrr
serve_foreverrrrrrDts  rHrzTestSMTPServer.startH	%++43E3E262D2D1FH	Hq		rjc~	|js0tj||jd|js/yy)Nr)rcount)rr
loop_map)rDrs  rHrzTestSMTPServer.serve_forevers-	**MM-TYYa@**rjc	d|_tj|jd|_|j	tj|jdy)NT)r
ignore_all)rrjoin_threadrrKr
	close_allrrms rHstopzTestSMTPServer.stopsF	
$$T\\2

tyyT:rjN)rprqrrrrrrrrsrjrHrr`s!(+
5	A	;rjrc2eZdZ	dZdZfdZdZxZS)ControlMixinc`d|_||_||_tj|_yr)rrrrrready)rDrrs   rHrzControlMixin.__init__s&*
__&
rjc	tj|j|jfx|_}d|_|j
yrrrs  rHrzControlMixin.startrrjcb	|jjtt||yr)rrrrr)rDrrs  rHrzControlMixin.serve_forevers'		


lD/
>rjc	|j|j&tj|jd|_|j	|j
j
yr)shutdownrrrserver_closerrMrms rHrzControlMixin.stopsQ		


<<#((6DL

rj)rprqrrrrrrrrs@rHrrs'?	rjrc eZdZ			ddZdZy)TestHTTPServerNcGfddttj||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)rDformatr1DelegatingHTTPRequestHandlerrrs   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]rOrr)rDsockres    rHget_requestzTestHTTPServer.get_requestsv	++-JD${{{{..t.F
Tz		JJ2Q67	sAA	A=#A88A=)rFN)rprqrrrr'rsrjrHr
r
s	58#'&	rjr
c0eZdZ	dZ		ddZfdZxZS)
TestTCPServerTcGddt}tj||||tj|||y)NceZdZdZy);TestTCPServer.__init__.<locals>.DelegatingTCPRequestHandlerc:|jj|yrrrms rHrUzBTestTCPServer.__init__.<locals>.DelegatingTCPRequestHandler.handlerrjN)rprqrrrUrsrjrHDelegatingTCPRequestHandlerr,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)rprqrrallow_reuse_addressrr2rrs@rHr)r)s%47#'<11rjr)c6eZdZ			ddZfdZfdZxZS)
TestUDPServercGfddttj|||tj|||d|_y)Nc(eZdZdZfdZxZS);TestUDPServer.__init__.<locals>.DelegatingUDPRequestHandlerc:|jj|yrrrms rHrUzBTestUDPServer.__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)rprqrrrUr>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)rprqrrrr2rrrs@rHr7r7$s$ 58#',1rjr7AF_UNIXc$eZdZejZy)TestUnixStreamServerNrprqrrrrCaddress_familyrsrjrHrErETrjrEc$eZdZejZy)TestUnixDatagramServerNrFrsrjrHrJrJWrHrjrJc0eZdZejZdZdZy)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@SMTPHandlerTIMEOUTrZtoaddrsmessagesrrrhandledrUrrrCis_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)rDr1s  rHrzSMTPHandlerTest.process_messagezs$

T"rjN)rprqrrrLONG_TIMEOUTrUr[rrsrjrHrLrL\s""G0rjrLc^eZdZ	dZdZdZdZdZdZe	jdZy)	MemoryHandlerTestrcJtj|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~)rv	rbr8)rfrrnrirrrwstr)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)NrkrlrbF)rfrrnrirrLrerKrr@rdrr:rBrDrps  rHtest_flush_on_closez%MemoryHandlerTest.test_flush_on_closesf		
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)NhandlerListrkrlrbF)rfrrnrirrr
weakrefrefrer@rdrr:rBrus  rHtest_shutdown_flush_on_closez.MemoryHandlerTest.test_shutdown_flush_on_closesb		
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   rHrUzaMemoryHandlerTest.test_race_between_set_target_and_flush.<locals>.MockRaceConditionHandler.handles3"))1B1BC##F+rjN)rprqrrrrrUrsrjrHMockRaceConditionHandlerrs
"
.
rjrrbrznot flushedflushed)rerrwrxrzrfrrrrr)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)rprqrrrWrIrSrsrvr|rrrrsrjrHr`r`~sF&32 %8%<%:1002535rjr`ceZdZ	dZy)ExceptionFormatterc&d|djzS)Nz
Got a [%s]r)rp)rDeis  rHformatExceptionz"ExceptionFormatter.formatExceptionsbenn,,rjN)rprqrrrrsrjrHrrs
(-rjrcN|jtj|yrrKr0remove)rRr4s  rHcloseFileHandlerr	sGGIIIbMrjc6eZdZ	ejZdZdZdZdZejddZ
ejddZd	ezd
zZejddZ
d
ZdZdZdZdZdZdZdZefdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$y$)%ConfigFileTest^(\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)NrGrE)r4r5textwrapdedentrconfig
fileConfig)rDconfr2files    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	exceptionrOstdoutseekrZrXrirs   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)rzr~rcompiler.lexer)rr)r|r)rr)r|r)rrrconfig1arrrrnrcriticalriconfig7rVrrDrr
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-rr\z\\)r.r)
check_no_resource_warningr5r0rFreplaceconfig8rrrrootr@rr)rDr4rrs    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_testrrrVrrCrDrs  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.r/r0rKr<rrrrr)rDr3r4s   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)Nat
            [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_rrasciirErFr9z5%(asctime)s [%(process)d] [%(levelname)s] %(message)sz[%Y-%m-%d %H:%M:%S %z]zlogging.Formatter)rdatefmtclass)versionr
formatters)rGdefaults)rrstripr.r/r0rencoderKrrrdictrQ)rDinir3r4s    rH!test_defaults_do_no_interpolationz0ConfigFileTest.test_defaults_do_no_interpolations<oo&'	(!!HB	HHRG,-HHRLNN%% -2!&]'?%8$ 

&
 
IIbMBIIbMs
A.CCN)%rprqrrr	rrWrconfig1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrsrjrHrr
s? / I I,G4G@H@oolL9Goo/1LMG*+*+G6oo35RSG'GT#GLG,G2L*D
&&$&-
&FF
&22)&V7$8*H0I6X*rjrc4eZdZ	eZdZdZdZdZdZ	dZ
y)SocketHandlerTestrNrc	tj|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}~wwxYwN{Gz?rNrr)rrIr	sock_hdlrserver_exceptionserver_classaddress
handle_socketrr]rrrr@
SocketHandler
isinstanceserver_addressr_r
log_outputr1rLrBr	SemaphorerXrDrr&hclss    rHrIzSocketHandlerTest.setUp:s/	7t?CCCdnt'<	#'#4#4T\\595G5G$O
ODK&LLN	--f++U3!+v{{;DN!&"7"7>DN&&t'7'7'@'@'CD##DNN3 **1-	$%D!	s>E##	E=,E88E=cH		|jr?|jj|j|jj|jr|jjtj|y#tj|wxYwr)rr1rLrKrrrrSrms rHrSzSocketHandlerTest.tearDownTsm&	$~~  ..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)Nrv>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)rr6r
retryStartrrrr1rrrxr	retryTimerz)rDnows  rH
test_noserverzSocketHandlerTest.test_noserverys  MM$//0%(!	5344	5&&|4	534iik4>>33S9

4>>++c1E9:z*sA$BBN)rprqrrr)rrrIrSrr7r<rsrjrHrr1s** LG.4	$
#	:+rjrzUnix sockets requiredc*eZdZ	eedreZdZy)UnixSocketHandlerTestrCctj|_|jtj
|jtj|yr)rcreate_unix_domain_namerrrrQrrIrms rHrIzUnixSocketHandlerTest.setUp8$<<>	(($,,7%rjN)rprqrrhasattrrrErrIrsrjrHr>r>s4vy!+&rjr>c.eZdZ	eZdZdZdZdZdZ	y)DatagramHandlerTestrc	tj|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}~wwxYwr)rrIrrrrrhandle_datagramrr]rrrr@DatagramHandlerrrr_rrr1rLrBrrrXr s    rHrIzDatagramHandlerTest.setUps+	7t?CCCdnt'<	#'#4#4T\\595I5I4$Q
QDK&LLN	//f++U3!+v{{;DN!&"7"7>DN&&t'7'7'@'@'CD##DNN3 (	$%D!	s>E""	E<+E77E<cH		|jr|jj|jr?|jj	|j|jjtj|y#tj|wxYwr)rrrr1rLrKrrSrms rHrSzDatagramHandlerTest.tearDownsm&	${{  "~~  ..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-r0rKr1rs      rHrFz#DatagramHandlerTest.handle_datagramsk{{4#D	
+ll6"&&s+6::,,rjc|jr|j|jtjd}|j	d|j
j
|j
j|j	d|j
j
|j|jdy)Nudprr4r5)
rr6rrrrXrrMrZrrs  rHr7zDatagramHandlerTest.test_outputs  MM$//0""5)VV.9rjN)
rprqrrr7rrrIrSrFr7rsrjrHrDrDs%$ LG)4	$
:rjrDc*eZdZ	eedreZdZy)UnixDatagramHandlerTestrCctj|_|jtj
|jtj|yr)rr@rrrrQrDrIrms rHrIzUnixDatagramHandlerTest.setUps8$<<>	(($,,7!!$'rjNrprqrrrBrrJrrIrsrjrHrOrOs7vy!-(rjrOc4eZdZ	eZdZdZdZdZdZ	dZ
y)SysLogHandlerTestrc	tj|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)Nrrrj)rrIrsl_hdlrrrrrFrr]rrrr@rYrrr_rrr1rLrBrrrXr s    rHrIzSysLogHandlerTest.setUps7	7t=AAAdlT%:	#'#4#4T\\595I5I4$Q
QDK&LLN	--f++U3!6!6q!96;; GHDL 5 56DL&&t'7'7'@'@'CD##DLL1 (	$%D!	s>E//	F	8FF	cH		|jr|jj|jr?|jj	|j|jjtj|y#tj|wxYwr)rrrUr1rLrKrrSrms rHrSzSysLogHandlerTest.tearDownsm"	${{  "||  ..t||<""$d#Hd#r#cZ|j|_|jjyr)rKrrXr)rDr-s  rHrFz!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)rr6rrrrXrrr^rZrrMrU
append_nulidentrs  rHr7zSysLogHandlerTest.test_outputs  MM$//0""5)Y'../*@A"'Y'../*<=&Y'../*GHrjcBtjd}|jj|jj|j
d|jjtj|j|jdy)NrYrZr[)rrrUrKrXrMrrrr^rZrrs  rHtest_udp_reconnectionz'SysLogHandlerTest.test_udp_reconnection0sk""5)Y'../*@ArjN)rprqrrr7rrrIrSrFr7r_rsrjrHrSrSs,, LG)4	$I&BrjrSc*eZdZ	eedreZdZy)UnixSysLogHandlerTestrCctj|_|jtj
|jtj|yr)rr@rrrrQrSrIrms rHrIzUnixSysLogHandlerTest.setUp@rArjNrQrsrjrHrara8s4vy!-&rjraz$IPv6 support required for this test.c2eZdZ	eZdZfdZfdZxZS)IPv6SysLogHandlerTest)z::1rchtj|j_tt
|yr)rAF_INET6rrGrrdrIrs rHrIzIPv6SysLogHandlerTest.setUpOs#+1??(
#T02rjchtj|j_tt
|yr)rAF_INETrrGrrdrSrs rHrSzIPv6SysLogHandlerTest.tearDownSs#+1>>(
#T35rj)	rprqrrr7rrrIrSrrs@rHrdrdFs!1 LG366rjrdc eZdZ	dZdZdZy)HTTPHandlerTestcb	tj|tj|_yr)rrIrrrXrms rHrIzHTTPHandlerTest.setUp\s!	7t (rjc||j|_t|j|_|jdk(r9	t	|j
d}|jj||_|jd|j|jjy#d|_YGxYw)NrLzContent-Length)
commandrrWlog_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)rKrLrZrKrErFfuncNamer7r)'rrr1rLr@sslr0rWdirname__file__r
SSLContextPROTOCOL_TLS_SERVERload_cert_chaincreate_default_contextImportErrorr
rwrrrrserver_portr_h_hdlrrorBrdrXrMrrZrnrqueryrsdecoderrK)rDrr1r}rrherelocalhost_certr r~rhost
secure_clientrdrds                rHr7zHTTPHandlerTest.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)rprqrrrIrwr7rsrjrHrjrjWs )5 rjrjc&eZdZ	dZdZdZdZy)
MemoryTestc>	tj|i|_yr)rrI
_survivorsrms rHrIzMemoryTest.setUpsFtrjc	|D]:}t|t|f}tj||j|<<yr)rrrzr{r)rDr1r1keys    rH_watch_for_survivalzMemoryTest._watch_for_survivals?		4CS'49$C#*;;s#3DOOC 	4rjc	tjg}|jjD]!\\}}}||j	|#|r/|jdt
|dj|fzyy)Nz;%d objects should have survived but have been destroyed: %sz, )gccollectrrr]r^r[r)rDdeadid_repr_r{s     rH_assertTruesurvivalzMemoryTest._assertTruesurvivalsI


!%!6!6!8	#LS%#u}E"	#II.14TDIIdO0LM
NrjcD|jjtjtjd}|j||jtj|jj|j|j|j|jdg~|jtjd}|j|j|jddgy)Nr{)r{r8r})r{r8r~)r1r7rrrrr8rrnrir)rDr{r|s   rHtest_persistent_loggersz"MemoryTest.test_persistent_loggerss	
!!',,/&  %W]]#t0023		$##%&!
	
  "&		$##%&!!
	rjN)rprqrrrIrrrrsrjrHrrs4
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€rEr)rrr5rkrBrrLrKrrZrarstripr0rWisfiler)rDrr4rrrs      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	getwriterrGr4BytesIOr9rBrrLrKrXrZ)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)rprqrrrrrsrjrHrrs
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)rprqrrrrrsrjrHrr
	sF0Krjrc.tj||Sr)rr;)rrs  rH
formatFuncr2	sVW--rjceZdZddZy)myCustomFormatterNcyrrs)rDfmtrs   rHrzmyCustomFormatter.__init__6	srjr)rprqrrrrsrjrHrr5	s
rjrc*tjSr)rr9rsrjrHhandlerFuncr9	s  ""rjceZdZy)
CustomHandlerNrprqrrrsrjrHrr<	rjrceZdZy)CustomListenerNrrsrjrHrr?	rrjrceZdZy)CustomQueueNrrsrjrHrrB	rrjrc*tjSr)queueQueuersrjrH
queueMakerrE	s;;=rjcfd}|S)NcF|jdt|g|i|S)Nrespect_handler_level)
setdefaultr)rr@r2rs   rHfunczlistenerMaker.<locals>.funcI	s*13HIe9h9&99rjrs)arg1arg2rrs  ` rH
listenerMakerrH	s:Krjc
LeZdZ	ejZdZddddiiddddd	d
iddgdd
Zddddiiddddd	d
idddgdiddidZddddiiddddd	d
idddiiddgddZddddiidddddd
idddgdiddidZ	ddddiiddddd	d
idddgdiddidZ
ddddiiddddd	d
idddgdiddidZddddiiddddd	d
idddgdiddidZddedzddiddddd	d
iddgdd
Z
deddedzddeddddddd	d
deidddgdd
Zddddiidedzddd	d
idddgdiddidZddddiidedzddd	ddidddgdiddidZddddiiddddd	d
id ddgdiddidZdd!dddiiddddd	d
iddgdid"ddid#Zdd$dddiiddddd	d
iddgdid"ddid#Zddddiiddddd	d
idddgdiddidZdd$dddiiddd%iid&Zdd$ddd%iiddd%iid&Zddddiid'd(diiddddd	d'gd)iddd'gd*iddgdd+Zddddiiddddd	d
id,dd-idddgdiddid.Zdddiiddddd	d
id,dd-idddgdiddid/Zd0dddiiddddd	d
id,dd-idddgdiddid.Zddddiiddddd	d1d2d3d4iddgdd
Zddd5d6d7id8iddddd	d
iddgdd
Zdd9d:d;d<iddd9d=d>d?d9d@ddAdBdCddDgdEdFidGZ ddedzdd!dHiddddd	d
idIddgdEdFidGZ!ddedzdd!dJiddddd	d
idIddgdEdFidGZ"ddedKzdd!dJiddddd	d
idIddgdEdFidGZ#ddedd!dHiddddd	d
idIddgdEdFidGZ$ddedLd6dMidNiddddd	d
idIddgdEdFidGZ%ddOdPidQdRgdSdTddUgddVZ&dWZ'dXZ(dYZ)efdZZ*d[Z+d\Z,d]Z-d^Z.d_Z/d`Z0daZ1dbZ2dcZ3ddZ4deZ5dfZ6dgZ7dhZ8diZ9djZ:dkZ;dlZ<dmZ=ddoZ>e?jdpZAe?jdqZBe?jdrZCdsZDdtZEduZFdvZGdwZHdxZIdyZJdzZKd{ZLd|ZMd}ZNd~ZOdZPdZQdZReSjdZUdZVyn)ConfigDictTestrrform1rz%(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|!
)r{
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@)r	ahr
rr@rcBtjj|yr)rr
dictConfig)rDrs  rHrzConfigDictTest.apply_configys!!$'rjcRtj|}|j||yr)rgetHandlerByNamer)rDrFrprRs    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)rrrrrrr9rrrOrrrZrXrirDrs  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)
rrrconfig4arrrrOrrrZrXrirs  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)	Nrrrrrrrr~r|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)rrrrrrrrnrrirrr9rVrrs   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)rrrrrrr9rrrnrrriconfig8arVrrs    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"rZr{rrrCrXrZ)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)NrrrrrrE)rfilenamerGr@rr)rr5rrrr@rr)rDr4rrs    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)NrErg@rNr%)rrrlistenrrrrrMrrhSOCK_STREAM
settimeoutconnectr)rJr[sendrK
stopListeningrr)rDtextverifyrrr%r0rh	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#1swYyxYwr3)rrrWjsondumpsr4rrr9rrrnrrirs   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)
rrrWrrrrrrrrnrrirs   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)Ncyrrsstuffs rHverify_failz6ConfigDictTest.test_listen_verify.<locals>.verify_fail
srjc|dddS)NrIrsr`s rHverify_reversez9ConfigDictTest.test_listen_verify.<locals>.verify_reverse
s2;rjrrrrr)rcr%r&rIr(r))
rrrrrrrrrWrrnrri)rDrbrdrto_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#deepcopyrhrrrr@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tyrs)r custom_formatter_class_validate2rrr@rrrrus  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)	rtr#rrrr@rrrrps   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)rhbcr&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)rDrr1r2rrs    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_typerh)rrr	myhandler)rrrrrzsome logzsome log my_type
)
collectionsrrr9rrrrrZrX)rDrrrrrrs      @rHtest_namedtuplezConfigDictTest.test_namedtupleds*	,--	,j68*<=C59# ( &K=A	

$
$
&	%&f%LL$	%	
*,@A	%	%s'B,,B5cld}|jdd|gddgtj_y)Ncyr1rs)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>.FakeFiltercyr1rs)rDrs  rHrzIConfigDictTest.test_config_filter_method_works.<locals>.FakeFilter.filtersrjNrrsrjrH
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>.NotAFilterNrrsrjrH
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@r	rEr
rlistenerr{r|bazzqueue not emptyrEr)r{r|r)r#rkconfig_queue_handlerr5rrrrZrnroassertIsNotNonerrrrrrsleeping_retryr^remptyrrrarYrrrr0r)	rDqspeclspeccdr4qhrrrRs	         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.CustomListenerrvrr{r|z Unable to configure handler 'ah')rrpr	itertoolsproductrrpr<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)rrrhr)rrr@rrr)rrrVrrrC)rDrrs   rH
test_90195zConfigDictTest.test_90195s(-$4$!*
 ""3')&!)9a.)(-.&!)rjr)Wrprqrrr	rrWrrrrrrrrrrrrrrrrr,rr/r0r4r7r:r>rBrIrhrtrxr}rrrrrrrrrrrrr rr#rr*r-r1r5r8r;r?rCrFrJrWrrequires_working_socketr[r]rfrirqrvryr{r~rrrrrrrrrrrrrrsrjrHrrN	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])rDrrr1exc_infoextraloggeds      rH_logz;ManagerTest.test_manager_loggerclass.<locals>.MyLogger._logs

c"rjro)rprqrrr)rsrHMyLoggerrs
#rjrrzshould appear in loggedzshould not appear in logged)
rLoggerManagerr<	TypeErrorsetLoggerClassrprrrZ)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)rprqrrrrrsrjrHrrs> 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)Nr{foo.barzfoo.bar.baz.bozzr|)rrgetChildrenrZassertNotInr)rDrrrl3l4kidsrfs        rHtest_get_childrenz!ChildLoggerTest.test_get_children2s


u
%


y
)


1
2


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

&rjrceZdZy)DerivedLogRecordNrrsrjrHr	r	Arrjr	ceZdZdZdZdZy)LogRecordFactoryTestcGddtj}tj||t|_|jj|j
tj|_	y)NceZdZdZdZy)2LogRecordFactoryTest.setUp.<locals>.CheckingFilterc||_yr)rp)rDrps  rHrz;LogRecordFactoryTest.setUp.<locals>.CheckingFilter.__init__Hs	rjcpt|}||jurd|d|j}t|y)NzUnexpected LogRecord type z, expected T)rrpr)rDrrrs    rHrz9LogRecordFactoryTest.setUp.<locals>.CheckingFilter.filterKs5LDHH$IJ HH&C#C.(rjN)rprqrrrrrsrjrHCheckingFilterrGs

rjr)
rrrrIr	rr1rgetLogRecordFactory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<rr1rrnrrr	rrirms rHtest_logrecord_classz)LogRecordFactoryTest.test_logrecord_class]sn)T%5%5%=%=++-	/##$45t0023!
	rjN)rprqrrrIrSrrsrjrHrrDs:$7
rjrc$eZdZdZdZdZdZdZeje
ejdddZ
eje
ejddd	Zeje
ejddd
Zy)QueueHandlerTestrctj|tjd|_tj
j
|j|_d|_t	jd|_
d|j_|jjtj|jj|jy)NrIqueF)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_nowaitrrrCrrrrZrFrr1)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}r~T)rrrr)rrMatcherrr@r)rrrrrnrrrrCmatchesrr|rzrKr7rV)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
skipUnlessrBrr@r-r6r8rsrjrHrrgs32 
=<X!1!1?CPRRBX!1!1?CPRKRKX!1!1?CPR	PR	Prjrr))patchceZdZ	dZedZejejjddZejejjddZedZ
dZdZy	)
QueueListenerTestc>	tjd|z}|jtjtjj|}|j
|tjj|}|j|jd|jd|jd|jd|jd|j|j||jy)Nztest_logger_with_id_%sonetwothreefourfive)
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  )MMOrjrUct|jD];}tj}|j	||jd|=|j
|jd|jzdyNrrz&correct number of handled log messages)rwrepeatrrrErrZ
call_countrDmock_handlerrrDs    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|jzdyrG)r*skip_if_broken_multiprocessing_synchronizerwrHmultiprocessingrrErrKrrZrIrJs    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 )rDs rHget_all_from_queuez$QueueListenerTest.get_all_from_queue
s9
#..00;;
	
s30303c
8	tjt|jD]}t	j
}|j
||jd|t|j|}|j|jgtjjjgg}|j!||d|Dcgc]*}t#|tj$r|j&n|,c}zycc}w)Nrz&Found unexpected messages in queue: %s)rrNrwrHrOrrErlistrRrKrrr@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)rDrDrs   rHtest_calls_task_done_after_stopz1QueueListenerTest.test_calls_task_done_after_stop-se
I''55i@HNNMMO"":.
&##%
&
&
&s)BBN)rprqrrrHstaticmethodrEr:rrr@r)rLrPrRrVrYrsrjrHr<r<s	
		
	.
g&&44h	?	G
@	G
g&&44h	?
	G
@
	G
	
		>0	&rjr<ceZdZdZeZdZy)UTCctSr)ZEROrDdts  rH	utcoffsetz
UTC.utcoffset;srjcy)Nr\rsr_s  rHtznamez
UTC.tzname@srjN)rprqrrradstrcrsrjrHr\r\:sCrjr\ceZdZdZy)AssertErrorMessagec	|jdg|i|y#|$r%}|j|t|Yd}~yd}~wwxYw)Nrs)r<rZro)rDrrr1r2r&s      rHassert_error_messagez'AssertErrorMessage.assert_error_messageGsH	.Db24262	.Wc!f--	.sA>AN)rprqrrrhrsrjrHrfrfEs.rjrfcPeZdZdZd
dZdZdZdZdZdZ	d	Z
d
ZdZdZ
y)
FormatterTestc	dtjtjj	ddddddddd|_d	d	d
ii|_y)Nzformatter.testrWtoz	dummy.extrzMessage with %d %s)rplaceholders)rFrpathnamelinenorrrr1customi)rr8r0rWrcommonvariantsrms rHrIzFormatterTest.setUpNsP$]]VT;?''	

$

rjNct|j}||j|j|t	j
|Sr)rrqrNrrrr)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
rtrr;rZrr<r^rVusesTimerCrDrrs   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}rwrys   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}--rwrys   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)_rrz
%(foo)#12.3*fz%(foo)0*.8*fz;invalid format: invalid field name/expression: 'name-thing'z{name-thing}zinvalid format: no fieldsrvzinvalid 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 $.r{z	${asctime)rr;rZ_fmtr<r^rhrDrs  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|rrpDefault)rr	z#Default Message with 2 placeholdersz 1234 Message with 2 placeholdersr}zNon-existing)r\rr;rtrZrr<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)Nrvrr{%(asctime)s %(message)sz1993-04-21 08:03:00,123z%Y:%dz1993:21)rtdatetimeutcrxmktime
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_formatrsrjrHNoMsecFormatterrUs"&"5rjrrrvrrrrrz21/04/1993 08:03:00)rr;rtrrrxrrrrrrrZr)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;rwrxrzrrr)rDrrrrrhs     rHtest_issue_89047zFormatterTest.test_issue_89047`sr"ESZmnt	)AJJv%%ula!e.D&EFAAWa(		)rjr)rprqrrrIrtrzrrrrrrrrrsrjrHrjrjMs?
"-
&& &*TQlN(J?
A)rjrjceZdZdZdZy)TestBufferingFormattercdt|zS)Nz[(%d)r[rDrs  rHformatHeaderz#TestBufferingFormatter.formatHeaderjW%%rjcdt|zS)Nz(%d)]rrs  rHformatFooterz#TestBufferingFormatter.formatFootermrrjN)rprqrrrrrsrjrHrris&&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)rprqrrrIrrrsrjrHrrps
;
GrjrceZdZdZy)
ExceptionTestcV|j}t}|j|	td#t	j
ddYnxYw|j
||j|jd}|j|jjd|j|jjd|j|jjd|j|jjd	y)
NrfailedTr0rz#Traceback (most recent call last):
z!
RuntimeError: deliberate mistakeStack (most recent call last):
z,logging.exception('failed', stack_info=True))r1RecordingHandlerrBrrrrLrKrrCexc_textrrZr1)rDrrRs   rHr(zExceptionTest.test_formattings	Q	9344	9h48			
IIaL

--/>?	@

++-AB	C//1>?	@--/?@	As	4AN)rprqrrr(rsrjrHrrsArjrceZdZdZy)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)rprqrrrrsrjrHrrs#;rjrceZdZdZdZy)FakeHandlerc
NdD] }t|||j|||"y)N)rrrKr)setattrrecord_call)rD
identifiercalledrds    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Drjrs)rDrrrrs ``` rHrzFakeHandler.record_calls	ErjN)rprqrrrrrsrjrHrrs
Prjrc$eZdZfdZdZxZS)rc:tt|
|i|g|_yr)rrrr)rDr1r2rs   rHrzRecordingHandler.__init__s
.??rjc<	|jj|yr)rr]rs  rHrUzRecordingHandler.handles4F#rj)rprqrrrrUrrs@rHrrs
$rjrczeZdZ	fdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZxZS)ShutdownTestctt|g|_tj
}|j
ttd|y)Nr)rrrIrrrrr)rDraise_exceptionsrs  rHrIzShutdownTest.setUps7
lD')"22*;=MNrjcfd}|S)Ncrrs)rsrHrz'ShutdownTest.raise_error.<locals>.inners
'Mrjrs)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
rTrZ)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)NrrxrrI)
rrrrrrzr{r
rTrZ)rDrdrrr@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(rrj)rprqrrrIrrrrrrrrrrrrr	rrrrs@rHrrsY-O
0 9><<A??A??1
/
/rjrcdeZdZ	dZddZdZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZy)ModuleLevelMiscTestctjjj}|j	|d|jtj|tjd|j	tjjjd|j
ttjdGdd}|j
ttj|tjdtj|j	tjjjtjy)NrS
doesnotexistsceZdZy);ModuleLevelMiscTest.test_disable.<locals>._NotAnIntOrStringNrrsrjrH_NotAnIntOrStringr=rjrWARN)
rrrrOrZrr<r^rrz)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)rhkwrs  rH<lambda>z/ModuleLevelMiscTest._test_log.<locals>.<lambda>Lsv}}aW'=rjztest me: %rrr)
rr:rrrrBr-rZr[r
getMessageupperr)rDrdr	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>.MyLoggerNrrsrjrHrr?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@rHrrDs$.gnn
.
.rjrjust_some_loggerrFhellorr)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
        rLrErzERROR:root:log in __del__)rTESTFNrrQrrrrrZrar)rDrErNfps    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()
        rLz#Cannot recover from stack overflow.r)rrrrrrZrMs     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)rprqrrrr%r(r,r0r4r8r;rArJrRrVrXr^rsrjrHrr.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)rrrrBrrrr1rZrrLrK)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_rOmsg2_)processNamer1.processNamer2.processName)rlogMultiprocessingrOcurrent_processrFrr	swap_itemrOmodulesrkrP)	rrnr.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)NrOTMainProcessrrkrlrmrrr)rrNrOrqrZrrnrrkrwrOPipeProcessrr(assertNotEqualr)	rDmultiprocessing_importedLOG_MULTI_PROCESSINGrrvrOparent_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
threadNameprocessrktaskName
logThreadslogProcessesrnlogAsyncioTasks)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)rrrrrprOrqrrrrrrs   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)rprqrrrcrgrZrwrrrrrrrrsrjrHr`r`so)	0#'J8@%W$$&	0'	0%W$$&	0'	0rjr`ceZdZ	fdZfdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZej0dZddZdZdZdZdZdZdZ xZ!S)BasicConfigTestc|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@rr9r6rOrrrlr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 errorrrrrrOrrrrZrXr
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|yrrr	h2r4s   rHrz.BasicConfigTest.test_filename.<locals>.cleanupHHJHHJIIbMrjtest.logrE)rErGrrrhr)rrrZr[rr@rrkr6moderFrrDrrrfs    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>.cleanuprrjrwbrEfilemoder)	rrrr@rkrZr6rrrs    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@rrZrlrrDrs  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@rrrlrmrs  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)rEr6)rEr@)r6r@)loglevelrhr)r<rr9rOrr^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)rr9rOrr;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)
NrErr%(message)srErGerrorsrrrr.The Øresund Bridge joins Copenhagen to Malmörrrr8rZr[rr@rrkrGrrKrrar
r0rrDrGrrrs     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)NrrignorerrrrrrErz*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)rErGrrrrbackslashreplaceu<😂: ☃️: The Øresund Bridge joins Copenhagen to MalmörErzL\U0001f602: \u2603\ufe0f: The \xd8resund Bridge joins Copenhagen to Malm\xf6)rrr8rZr[rr@rrkrGrrrKrrar
r0rrs     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]rorOr)rrs rHdummy_handle_errorzEBasicConfigTest.test_encoding_errors_none.<locals>.dummy_handle_errorzss3==?34rjrz:'ascii' codec can't encode character '\xd8' in position 4:rErr)rrr8rZr[rr@rrkrGrrrrrCrrKrrar
r0r)rDrGrrrrrs      @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)rrrsrjrHr'z5BasicConfigTest.test_log_taskName.<locals>.log_recordsOOM*srztest-logging-taskname-rErz%(taskName)s - %(message)s)rErrGrrrrT)rrzTask-\d+ - hello world)r5rr0rrrrrZr[rr@rrkrrrrrrar
assertRegexrrK)rDr'rlog_filenamerGrrrs        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])rhrrrold_basic_configrDs   rHmy_basic_configz2BasicConfigTest._test_log.<locals>.my_basic_configsR**ILL!!#&OOGLL119=MM1b'"rjrztest mers)rrrr:r-rZ)rDrdrrr#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 rHr0zBasicConfigTest.test_infor1rjc&|jdyr3r+rms rHr4zBasicConfigTest.test_warningr5rjc&|jdyr7r+rms rHr8zBasicConfigTest.test_errorr-rjc&|jdyr:r+rms rHr;zBasicConfigTest.test_criticalr<rjr)"rprqrrrIrSrrrrrrrrrrrrrrrrrrrrrr%r(r,r0r4r8r;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)r4rrr"rZr[rrrr|rr1rr
__traceback__rDrr5r&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/)
r4rrrZr[r"rrrr)rDr&r5rs    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[rrrrzrr1)rDrrs   rHr;zLoggerAdapterTest.test_criticals!c4>>2T^^334a8''*)9)9:S)t~~&78rjcb|jjjj}d|jjj_|j	t
|jjjd||j
|jjdy)N!rO )rrrrOrrrV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@rLrVrus  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)rDrr2s   rHrz6LoggerAdapterTest.test_nested.<locals>.Adapter.process s++au-v55rjN)rprqrrrrrsrjrHrrsF
6rjrzAdapters can be nested, yo.rAdapterAdapterrrzAdapter AdapterAdapter )rrrrrZrrrzr"r[rrrr1rrr)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)rprqrrrIr	rr;rrr rrs@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)rhrrr7rms 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)r4rrr"rZr[rrrr|rr1rrrrs     rHr	zLoggerTest.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&DrjTr0rrr)rr:r	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)
stacklevelrs)	the_leveltriggersrH	innermostz>LoggerTest.test_find_caller_with_stacklevel.<locals>.innermostxs
Fy1rjcyrrs)r:srHrz:LoggerTest.test_find_caller_with_stacklevel.<locals>.inner{sKrjcyrrs)rsrHouterz:LoggerTest.test_find_caller_with_stacklevel.<locals>.outer~sGrjrIr:rr= test_find_caller_with_stacklevel)rrr"rrZrrorrrrBrL)	rDr=rror1rr:r8r9s	     @@@@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)
rDrFrr4lnorr1rrrDrvrrs
             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@rA	valid_keyrBrC)rrHrrF)rDrFrr4rIrr1rrrDrrs            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@rLrVrus  rHrzLoggerTest.test_has_handlerssa//12{{++	/GKK%%g.	/0023rjcztjd}d|_|j|j	y)Nz
blah.childF)rrrgrVr?)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)rrrOrrrVrrs  rHrzLoggerTest.test_is_enabled_forsbkk))11&(#!4!4iM11"56rjc|jj}|jjj}d|j_d|jj_|j	t
|jd||j	t
|jjd||j
|jjdy)NTrrrOrU)rrrrOrrrVr)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)Nrrr{r)rrrrrr[)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)rrr{rzbaz.bar)rwr+HIGHEST_PROTOCOLrrrZr,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_cacherCrrVr8rzrrO)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'r	r,r.r4r>rKrNrrRrrXr[r^rcrfrrs@rHr"r">s^**B"P2H%7N8445
7
7D@16>rjr"c&eZdZ	dZdZdZdZy)BaseFileTestc^tj|tdd|_g|_y)Nrztest_logging-2-)rrIr5r4rmfilesrms rHrIzBaseFileTest.setUp$s$t ):;rjc
|jD]}tj|tjj	|j
rtj|j
tj|yr)rjr0rQrWrXr4rrS)rDr4s  rHrSzBaseFileTest.tearDown)sR,,	BIIbM	
77>>$''"IIdgg$rjc	|jtjj|d|z|jj|y)NzLog file %r does not existr)rCr0rWrXrjr])rDrEs  rH
assertLogFilezBaseFileTest.assertLogFile0s@Ax088C		EH%rjc
rtjdtjdd|jdddS)Nrqrr)rrr8rnrms rHnext_reczBaseFileTest.next_rec6s5  gmmS!!%!2!2!4dD$H	HrjN)rprqrrrIrSrnrprsrjrHrhrh!s7
 &HrjrhceZdZdZdZy)FileHandlerTestc:tj|jtj|jdd}|j|j|jtjj|j|jtji|j|j|jtjj|j|jy)NrETrF)r0rQr4rrkrr6rVrWrXrUrrrCrK)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)NrErg)rGrrr{)r0rQr4rrkr>r;r>rprKrrZrar
)rDrtrUs   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)rprqrrrurwrsrjrHrrrr:s	5rjrrceZdZejejddZdZdZ	dZ
dZejdZ
y)	RotatingFileHandlerTestWASI does not have /dev/null.ctjj|jdd}|j	|jd|j
tjjtjdd}|j	|j|j|j
y)NrErrGmaxBytesr)
rr@rlr4rVshouldRolloverrKr0devnullrprDrhs  rHtest_should_not_rolloverz0RotatingFileHandlerTest.test_should_not_rolloverQs


1
1'A27**401




1
1

Wq2:**4==?;<

rjctjj|jdd}|j	|j|j
|jy)NrErr|)rr@rlr4rCr~rprKrs  rHtest_should_rolloverz,RotatingFileHandlerTest.test_should_rollover`sJ



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

rjctjj|jd}|j	|j|j
|j|jy)NrEr)rr@rlr4r>rprnrKrs  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.testrsr%s rHnamerz>RotatingFileHandlerTest.test_rollover_filenames.<locals>.namerns'>!rjrErrrGbackupCountr}.1.2.3)
rr@rlr4rr>rprnrVr0rWrXrK)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|dzSrrs)rDrFs  rHrz`RotatingFileHandlerTest.test_namer_rotator_inheritance.<locals>.HandlerWithNamerAndRotator.namer~sg~%rjcvtjj|rtj||dzyy)N.rotated)r0rWrXr)rDsourcedests   rHrotatorzbRotatingFileHandlerTest.test_namer_rotator_inheritance.<locals>.HandlerWithNamerAndRotator.rotators*77>>&)JJvtj'89*rjN)rprqrrrrrsrjrHHandlerWithNamerAndRotatorr}s
&
:rjrrErrrrrr)rr@rlr4rZrr>rprnrVr0rWrXrK)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.gzrsr%s rHrz3RotatingFileHandlerTest.test_rotator.<locals>.namers%<rjc t|d5}|j}tj|d}t|d5}|j	|ddddddtj|y#1swY'xYw#1swY+xYw)Nrbrnr)rrazlibcompressrr0r)rrsfr
compresseddfs      rHrz5RotatingFileHandlerTest.test_rotator.<locals>.rotatorsyfd#
)rwwy!]]43
$%)HHZ()
)

IIf))
)
)s#3BA8B8B	=BB
rErrrrrrrr)rr@rlr4rrrpr>rnr0lineseprrar
decompressrZrrrVrWrXrK)rDrrrm1m2r4newlinerrrs           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_zlibrrsrjrHryryPsZX__W__&EFG

&W**rjrycpeZdZejejddZdZdZ	dZ
dZdZy)	TimedRotatingFileHandlerTestrzctjjtjddd}tjdtjddi}|j|j||jy)NSrErrGr皙?rztesting - device file)rr@rmr0rrxrzrrVr~rK)rDrtrs   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)NrrErrrrztesting - 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:rrm) rr@rmr4r;r>rr>rnrxrzrKrr;rw	timedeltastrftimer0rWrXrjr]rlistdirrrrOrrrrarC)rDrtrrtrufoundr;GO_BACKsecsprevr4rdnrfilesrWtfs                 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)NXrETrFWW7)r<r^rr@rmr4)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rEMIDNIGHTrTrGwhenintervalrratTimeжi@)	rrxrr@rmr4computeRolloverrZrK)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)NQrrrEzW%drTrrzfailed in timezone: %dzlocal vars: %si:	r)rprxrrtm_wdayrwrr@rmr4rrtimezonelocalsrZrK)	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)rrrrHrz.log.c,|jdddzS)Nrr)rr%s rHrzKTimedRotatingFileHandlerTest.test_compute_files_to_delete.<locals>.<lambda>JsT\\&"-E-Nrjrrrrz%s.log.r)r.mkdtemprshutilrmtreerr;rwr]rrr0rWrrr@rmrrr	enumerategetFilesToDeleterZr[rrCrZisdigit)rDwdtimesr`rrprefixesrrotatorsrrrrr4r
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)
rprqrrrrrrrrrrrrrsrjrHrrsDX__W__&EFG((TB
 &P.CrjrcZtjdi|tjdzS)Nrrrs)rr)rs rHrrds&##x'9'9!'DDDrj)rr)M<)Hi)Dr)rrW0rv)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)NrErrT)rGrrrrgrrrvrrzt: z ()rzcurrentHour: %szcurrentMinute: %szcurrentSecond: %szr: %sz
result: %sz exception in diagnostic code: %s)rr@rmr4rrrxr	localtime	_MIDNIGHTrrOrrrZrK)
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 recordsrm)win32evtlogOpenEventLogGetNumberOfEventLogRecordsrr@NTEventLogHandler
pywintypesrwinerrorrSkipTestrrUrK
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[rsrjrHrrs(rjrceZdZdZy)MiscTestCasecDhd}tj|t|y)N>rrFiltererr
RootLoggerrPlaceHolderrcurrentframerStrFormatStylerrnrm)not_exported)rcheck__all__r)rDrs  rHtest__all__zMiscTestCase.test__all__s,
	T7FrjN)rprqrrr!rsrjrHrrsGrjrcVtjtjddy)NLC_ALLr)renterModuleContextrrun_with_localersrjrHsetUpModuler&s 7 7" EFrj__main__r)F)rlogging.handlerslogging.configrrr#rrir+r4rrrYr0rr{rUrrr)rOr.test.support.script_helperrrrrtest.supportrrrr	r
test.support.logging_helperrrrrrxrrrzhttp.serverrr
urllib.parserrsocketserverrrrrrrrrrrrrTestCaserrurSILENTrTERSEEFFUSIVErr	TALKATIVEr
CHATTERBOXBORINGrwrrrrrrr5r7rrr9rrrrrrr
r)r7rBrErJrrrLr`r;rrrrr9r>rDrOrSraIPV6_ENABLEDrdrjrrrrrrrr@r)rrrrrrrrrr	rrrO
unittest.mockr:r<rr^tzinfor\rrfrjrrrrrrrrrrr`rrr"rhrrryrrrrrrrrr&rpmainrsrjrH<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[%[%2[7["%[43[47\?\