@@ -99,7 +99,7 @@ def tearDown(self):
9999 finally :
100100 logging ._releaseLock ()
101101
102- def assertTruelog_lines (self , expected_values , stream = None ):
102+ def assert_log_lines (self , expected_values , stream = None ):
103103 """Match the collected log lines against the regular expression
104104 self.expected_log_pat, and compare the extracted group values to
105105 the expected_values list of tuples."""
@@ -165,7 +165,7 @@ def test_flat(self):
165165
166166 INF .debug (m ())
167167
168- self .assertTruelog_lines ([
168+ self .assert_log_lines ([
169169 ('ERR' , 'CRITICAL' , '1' ),
170170 ('ERR' , 'ERROR' , '2' ),
171171 ('INF' , 'CRITICAL' , '3' ),
@@ -197,7 +197,7 @@ def test_nested_explicit(self):
197197 INF_ERR .info (m ())
198198 INF_ERR .debug (m ())
199199
200- self .assertTruelog_lines ([
200+ self .assert_log_lines ([
201201 ('INF.ERR' , 'CRITICAL' , '1' ),
202202 ('INF.ERR' , 'ERROR' , '2' ),
203203 ])
@@ -228,7 +228,7 @@ def test_nested_inherited(self):
228228 INF_ERR_UNDEF .info (m ())
229229 INF_ERR_UNDEF .debug (m ())
230230
231- self .assertTruelog_lines ([
231+ self .assert_log_lines ([
232232 ('INF.UNDEF' , 'CRITICAL' , '1' ),
233233 ('INF.UNDEF' , 'ERROR' , '2' ),
234234 ('INF.UNDEF' , 'WARNING' , '3' ),
@@ -256,7 +256,7 @@ def test_nested_with_virtual_parent(self):
256256 GRANDCHILD .debug (m ())
257257 CHILD .debug (m ())
258258
259- self .assertTruelog_lines ([
259+ self .assert_log_lines ([
260260 ('INF.BADPARENT.UNDEF' , 'CRITICAL' , '1' ),
261261 ('INF.BADPARENT.UNDEF' , 'INFO' , '2' ),
262262 ('INF.BADPARENT' , 'CRITICAL' , '3' ),
@@ -285,7 +285,7 @@ def test_filter(self):
285285 spam_eggs_fish .info (self .next_message ()) # Good.
286286 spam_bakedbeans .info (self .next_message ())
287287
288- self .assertTruelog_lines ([
288+ self .assert_log_lines ([
289289 ('spam.eggs' , 'INFO' , '2' ),
290290 ('spam.eggs.fish' , 'INFO' , '3' ),
291291 ])
@@ -367,7 +367,7 @@ def test_logger_filter(self):
367367 self .root_logger .setLevel (VERBOSE )
368368 # Levels >= 'Verbose' are good.
369369 self .log_at_all_levels (self .root_logger )
370- self .assertTruelog_lines ([
370+ self .assert_log_lines ([
371371 ('Verbose' , '5' ),
372372 ('Sociable' , '6' ),
373373 ('Effusive' , '7' ),
@@ -382,7 +382,7 @@ def test_handler_filter(self):
382382 try :
383383 # Levels >= 'Sociable' are good.
384384 self .log_at_all_levels (self .root_logger )
385- self .assertTruelog_lines ([
385+ self .assert_log_lines ([
386386 ('Sociable' , '6' ),
387387 ('Effusive' , '7' ),
388388 ('Terse' , '8' ),
@@ -413,12 +413,12 @@ def test_specific_filters(self):
413413 ('Taciturn' , '9' ),
414414 ('Silent' , '10' ),
415415 ]
416- self .assertTruelog_lines (first_lines )
416+ self .assert_log_lines (first_lines )
417417
418418 specific_filter = VerySpecificFilter ()
419419 self .root_logger .addFilter (specific_filter )
420420 self .log_at_all_levels (self .root_logger )
421- self .assertTruelog_lines (first_lines + [
421+ self .assert_log_lines (first_lines + [
422422 # Not only 'Garrulous' is still missing, but also 'Sociable'
423423 # and 'Taciturn'
424424 ('Boring' , '11' ),
@@ -458,29 +458,29 @@ def test_flush(self):
458458 # The memory handler flushes to its target handler based on specific
459459 # criteria (message count and message level).
460460 self .mem_logger .debug (self .next_message ())
461- self .assertTruelog_lines ([])
461+ self .assert_log_lines ([])
462462 self .mem_logger .info (self .next_message ())
463- self .assertTruelog_lines ([])
463+ self .assert_log_lines ([])
464464 # This will flush because the level is >= logging.WARNING
465465 self .mem_logger .warn (self .next_message ())
466466 lines = [
467467 ('DEBUG' , '1' ),
468468 ('INFO' , '2' ),
469469 ('WARNING' , '3' ),
470470 ]
471- self .assertTruelog_lines (lines )
471+ self .assert_log_lines (lines )
472472 for n in (4 , 14 ):
473473 for i in range (9 ):
474474 self .mem_logger .debug (self .next_message ())
475- self .assertTruelog_lines (lines )
475+ self .assert_log_lines (lines )
476476 # This will flush because it's the 10th message since the last
477477 # flush.
478478 self .mem_logger .debug (self .next_message ())
479479 lines = lines + [('DEBUG' , str (i )) for i in range (n , n + 10 )]
480- self .assertTruelog_lines (lines )
480+ self .assert_log_lines (lines )
481481
482482 self .mem_logger .debug (self .next_message ())
483- self .assertTruelog_lines (lines )
483+ self .assert_log_lines (lines )
484484
485485
486486class ExceptionFormatter (logging .Formatter ):
@@ -650,11 +650,11 @@ def test_config0_ok(self):
650650 logger .info (self .next_message ())
651651 # Outputs a message
652652 logger .error (self .next_message ())
653- self .assertTruelog_lines ([
653+ self .assert_log_lines ([
654654 ('ERROR' , '2' ),
655655 ], stream = output )
656656 # Original logger output is empty.
657- self .assertTruelog_lines ([])
657+ self .assert_log_lines ([])
658658
659659 def test_config1_ok (self , config = config1 ):
660660 # A config file defining a sub-parser as well.
@@ -664,12 +664,12 @@ def test_config1_ok(self, config=config1):
664664 # Both will output a message
665665 logger .info (self .next_message ())
666666 logger .error (self .next_message ())
667- self .assertTruelog_lines ([
667+ self .assert_log_lines ([
668668 ('INFO' , '1' ),
669669 ('ERROR' , '2' ),
670670 ], stream = output )
671671 # Original logger output is empty.
672- self .assertTruelog_lines ([])
672+ self .assert_log_lines ([])
673673
674674 def test_config2_failure (self ):
675675 # A simple config file which overrides the default settings.
@@ -692,7 +692,7 @@ def test_config4_ok(self):
692692 self .assertEquals (output .getvalue (),
693693 "ERROR:root:just testing\n Got a [RuntimeError]\n " )
694694 # Original logger output is empty
695- self .assertTruelog_lines ([])
695+ self .assert_log_lines ([])
696696
697697 def test_config5_ok (self ):
698698 self .test_config1_ok (config = self .config5 )
@@ -847,7 +847,7 @@ def test_persistent_loggers(self):
847847 foo .setLevel (logging .DEBUG )
848848 self .root_logger .debug (self .next_message ())
849849 foo .debug (self .next_message ())
850- self .assertTruelog_lines ([
850+ self .assert_log_lines ([
851851 ('foo' , 'DEBUG' , '2' ),
852852 ])
853853 del foo
@@ -856,7 +856,7 @@ def test_persistent_loggers(self):
856856 # foo has retained its settings.
857857 bar = logging .getLogger ("foo" )
858858 bar .debug (self .next_message ())
859- self .assertTruelog_lines ([
859+ self .assert_log_lines ([
860860 ('foo' , 'DEBUG' , '2' ),
861861 ('foo' , 'DEBUG' , '3' ),
862862 ])
0 commit comments