Skip to content

Commit 00e6914

Browse files
author
georg.brandl
committed
Merged revisions 73718,73721,73723 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r73718 | benjamin.peterson | 2009-07-01 01:35:19 +0200 (Mi, 01 Jul 2009) | 9 lines Merged revisions 73717 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r73717 | benjamin.peterson | 2009-06-30 18:30:12 -0500 (Tue, 30 Jun 2009) | 1 line use assert* methods in test_unittest ........ ................ r73721 | benjamin.peterson | 2009-07-01 02:43:10 +0200 (Mi, 01 Jul 2009) | 11 lines Merged revisions 73720 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r73720 | benjamin.peterson | 2009-06-30 19:36:41 -0500 (Tue, 30 Jun 2009) | 4 lines fix a few cases where automated fail -> assert translation messed up Thanks Joe Amenta ........ ................ r73723 | benjamin.peterson | 2009-07-01 02:45:43 +0200 (Mi, 01 Jul 2009) | 1 line remove use of failIf ................ git-svn-id: http://svn.python.org/projects/python/branches/release31-maint@74385 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent dfaee0e commit 00e6914

4 files changed

Lines changed: 77 additions & 77 deletions

File tree

Lib/ctypes/test/test_internals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919

2020
class ObjectsTestCase(unittest.TestCase):
21-
def assertTrueSame(self, a, b):
21+
def assertSame(self, a, b):
2222
self.assertEqual(id(a), id(b))
2323

2424
def test_ints(self):
@@ -33,7 +33,7 @@ def test_c_char_p(self):
3333
rc = grc(s)
3434
cs = c_char_p(s)
3535
self.assertEqual(rc + 1, grc(s))
36-
self.assertTrueSame(cs._objects, s)
36+
self.assertSame(cs._objects, s)
3737

3838
def test_simple_struct(self):
3939
class X(Structure):

Lib/test/support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def wrapper(self):
731731
# to make sure they work. We still want to avoid using
732732
# too much memory, though, but we do that noisily.
733733
maxsize = 5147
734-
self.failIf(maxsize * memuse + overhead > 20 * _1M)
734+
self.assertFalse(maxsize * memuse + overhead > 20 * _1M)
735735
else:
736736
maxsize = int((max_memuse - overhead) / memuse)
737737
if maxsize < minsize:

Lib/test/test_logging.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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

486486
class 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\nGot 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

Comments
 (0)