diff options
author | Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> | 2019-05-07 23:36:39 +0200 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2019-05-07 22:36:39 +0100 |
commit | ca87eebb22d202c33f3317cbf85059cadc64fa9f (patch) | |
tree | fd4407525a7e3da55050901a4500d03314006c08 /Lib/test | |
parent | 3918ad6b45da31e05265de5a455102276717c659 (diff) | |
download | cpython-git-ca87eebb22d202c33f3317cbf85059cadc64fa9f.tar.gz |
bpo-36015: Handle StreamHandler representaton of stream with an integer name (GH-11908)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_logging.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 950217cec2..bc99c3adbe 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -760,6 +760,10 @@ class TestStreamHandler(logging.StreamHandler): def handleError(self, record): self.error_record = record +class StreamWithIntName(object): + level = logging.NOTSET + name = 2 + class StreamHandlerTest(BaseTest): def test_error_handling(self): h = TestStreamHandler(BadStream()) @@ -797,6 +801,10 @@ class StreamHandlerTest(BaseTest): actual = h.setStream(old) self.assertIsNone(actual) + def test_can_represent_stream_with_int_name(self): + h = logging.StreamHandler(StreamWithIntName()) + self.assertEqual(repr(h), '<StreamHandler 2 (NOTSET)>') + # -- The following section could be moved into a server_helper.py module # -- if it proves to be of wider utility than just test_logging |