]> granicus.if.org Git - python/commitdiff
Fix indentation error in testGetServByName and rewrite loop to avoid clumsy
authorSkip Montanaro <skip@pobox.com>
Tue, 10 Feb 2004 15:51:15 +0000 (15:51 +0000)
committerSkip Montanaro <skip@pobox.com>
Tue, 10 Feb 2004 15:51:15 +0000 (15:51 +0000)
sentinel variable

Lib/test/test_socket.py

index b2db601599ca25c02d96b82295c1e288e068a62b..a2b8489434099d2fa81a57e0dff92658c4d0f2ea 100644 (file)
@@ -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