Commit 05eb4012 authored by Skip Montanaro's avatar Skip Montanaro

Fix indentation error in testGetServByName and rewrite loop to avoid clumsy

sentinel variable
parent 029dba5a
......@@ -273,22 +273,19 @@ class GeneralModuleTests(unittest.TestCase):
def testGetServByName(self):
# Testing getservbyname()
# try a few protocols - not everyone has telnet enabled
found = 0
for proto in ("telnet", "ssh", "www", "ftp"):
try:
socket.getservbyname(proto, 'tcp')
found = 1
break
except socket.error:
pass
try:
socket.getservbyname(proto, 'udp')
found = 1
break
except socket.error:
pass
if not found:
raise socket.error
else:
raise socket.error
def testDefaultTimeout(self):
# Testing default timeout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment