summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2012-10-17 11:24:27 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2012-10-17 11:24:27 (GMT)
commit284529dcf437b650eb72e92b88608e60aa90e10f (patch)
treee69a7f7518bd6f34ab201cb045049a0dde157e10 /Lib/test/test_logging.py
parentb4e4c92592f47e84a0175235d1c7759caccbbb42 (diff)
downloadcpython-284529dcf437b650eb72e92b88608e60aa90e10f.zip
cpython-284529dcf437b650eb72e92b88608e60aa90e10f.tar.gz
cpython-284529dcf437b650eb72e92b88608e60aa90e10f.tar.bz2
test_logging.py: where needed use unittest's assertGreater, assertLesser, assertIs rather than assertTrue (also in order to debug issue 16264)
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index a2a136b..1d93b47 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1450,7 +1450,7 @@ class SocketHandlerTest(BaseTest):
self.root_logger.exception('Never sent')
self.root_logger.error('Never sent, either')
now = time.time()
- self.assertTrue(self.sock_hdlr.retryTime > now)
+ self.assertGreater(self.sock_hdlr.retryTime, now)
time.sleep(self.sock_hdlr.retryTime - now + 0.001)
self.root_logger.error('Nor this')
@@ -1776,7 +1776,7 @@ class WarningsTest(BaseTest):
logger.removeHandler(h)
s = stream.getvalue()
h.close()
- self.assertTrue(s.find("UserWarning: I'm warning you...\n") > 0)
+ self.assertGreater(s.find("UserWarning: I'm warning you...\n"), 0)
#See if an explicit file uses the original implementation
a_file = io.StringIO()
@@ -2801,14 +2801,14 @@ class ChildLoggerTest(BaseTest):
l2 = logging.getLogger('def.ghi')
c1 = r.getChild('xyz')
c2 = r.getChild('uvw.xyz')
- self.assertTrue(c1 is logging.getLogger('xyz'))
- self.assertTrue(c2 is logging.getLogger('uvw.xyz'))
+ self.assertIs(c1, logging.getLogger('xyz'))
+ self.assertIs(c2, logging.getLogger('uvw.xyz'))
c1 = l1.getChild('def')
c2 = c1.getChild('ghi')
c3 = l1.getChild('def.ghi')
- self.assertTrue(c1 is logging.getLogger('abc.def'))
- self.assertTrue(c2 is logging.getLogger('abc.def.ghi'))
- self.assertTrue(c2 is c3)
+ self.assertIs(c1, logging.getLogger('abc.def'))
+ self.assertIs(c2, logging.getLogger('abc.def.ghi'))
+ self.assertIs(c2, c3)
class DerivedLogRecord(logging.LogRecord):
@@ -3889,7 +3889,7 @@ class NTEventLogHandlerTest(BaseTest):
h.handle(r)
h.close()
# Now see if the event is recorded
- self.assertTrue(num_recs < win32evtlog.GetNumberOfEventLogRecords(elh))
+ self.assertLess(num_recs, win32evtlog.GetNumberOfEventLogRecords(elh))
flags = win32evtlog.EVENTLOG_BACKWARDS_READ | \
win32evtlog.EVENTLOG_SEQUENTIAL_READ
found = False