aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_telnetlib.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-14 14:16:20 +0000
committerR. David Murray <rdmurray@bitdance.com>2010-12-14 14:16:20 +0000
commit32ef70c827997f869a8d8393e8bde74016b6c8a9 (patch)
tree2fb7aafb76221a226502a6fb5d52fcd536ade964 /Lib/test/test_telnetlib.py
parent8edd99d0852c45f70b6abc851e6b326d4250cd33 (diff)
downloadcpython-32ef70c827997f869a8d8393e8bde74016b6c8a9.tar.gz
cpython-32ef70c827997f869a8d8393e8bde74016b6c8a9.zip
#10695: use %s not %d so that a string 'port' does not cause a debug traceback
Passing the port as a string value works fine in regular mode, but if you turned debug on it would throw an error trying to print the port number, which is surprising and confusing.
Diffstat (limited to 'Lib/test/test_telnetlib.py')
-rw-r--r--Lib/test/test_telnetlib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
index e4210c5cf46..843daf15850 100644
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -342,6 +342,16 @@ class OptionTests(TestCase):
expected = "send b'xxx'\n"
self.assertIn(expected, telnet._messages)
+ def test_debug_accepts_str_port(self):
+ # Issue 10695
+ with test_socket([]):
+ telnet = TelnetAlike('dummy', '0')
+ telnet._messages = ''
+ telnet.set_debuglevel(1)
+ telnet.msg('test')
+ self.assertRegex(telnet._messages, r'0.*test')
+
+
def test_main(verbose=None):
support.run_unittest(GeneralTests, ReadTests, WriteTests, OptionTests)