[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Use list.pop where apprpriate; fix unit test failure



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv12559/lib/mixminion

Modified Files:
	MMTPClient.py test.py 
Log Message:
Use list.pop where apprpriate; fix unit test failure

Index: MMTPClient.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/MMTPClient.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- MMTPClient.py	6 Feb 2004 23:14:28 -0000	1.53
+++ MMTPClient.py	15 Feb 2004 23:25:33 -0000	1.54
@@ -148,8 +148,7 @@
         "Helper: begin transmitting the next available packet."
         # There _is_ a next available packet, right?
         assert self.packets and self._isConnected
-        pkt = self.packets[0]
-        del self.packets[0]
+        pkt = self.packets.pop(0)
 
         if pkt.isJunk():
             control = "JUNK\r\n"
@@ -295,8 +294,7 @@
                 self.startShutdown()
                 return
             ack = self.getInbuf(self.ACK_LEN, clear=1)
-            good, bad = self.expectedAcks[0]
-            del self.expectedAcks[0]
+            good, bad = self.expectedAcks.pop(0)
             if ack == good:
                 LOG.debug("Packet delivered to %s",self.address)
                 self.nPacketsAcked += 1

Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- test.py	6 Feb 2004 23:14:28 -0000	1.183
+++ test.py	15 Feb 2004 23:25:33 -0000	1.184
@@ -4470,8 +4470,8 @@
            "server at 1.2.3.4:48099")
         eq(dsbr(MMTPHostInfo("a.b.com", 48099, "x"*20)),
            "server at a.b.com:48099")
-        eq(dsba("1.2.3.4",48099), "server at 1.2.3.4:48099")
-        eq(dsba("1.2.3.4",48099, "X.Y"), "server at 1.2.3.4:48099")
+        eq(dsba("1.2.3.4",48099), "host at 1.2.3.4:48099")
+        eq(dsba("1.2.3.4",48099, "X.Y"), "host at 1.2.3.4:48099")
 
         # Test with keyid resolver
         def resolver(keyid):
@@ -4491,11 +4491,11 @@
                "server at 1.2.3.4:48099")
             eq(dsbr(MMTPHostInfo("ken.com", 48099, "a"*20)),
                "'Kenichi' at ken.com:48099")
-            eq(dsba("1.2.3.4",48099), "server at 1.2.3.4:48099 (Each?)")
+            eq(dsba("1.2.3.4",48099), "host at 1.2.3.4:48099 (Each?)")
             eq(dsba("1.2.3.4",48099,"a.b.c.d"),
-               "server at 1.2.3.4:48099 (Peach?)")
+               "host at 1.2.3.4:48099 (Peach?)")
             eq(dsba("3.4.5.6",48099,"x.y.z"),
-               "server at 3.4.5.6:48099")
+               "host at 3.4.5.6:48099")
         finally:
             mixminion.ServerInfo._keyIDToNicknameFn = None
             mixminion.ServerInfo._addressToNicknameFn = None