[Zodb-checkins] CVS: Zope3/src/zodb/tests - emailbench.py:1.2

Jeremy Hylton jeremy at zope.com
Tue Apr 22 12:19:56 EDT 2003


Update of /cvs-repository/Zope3/src/zodb/tests
In directory cvs.zope.org:/tmp/cvs-serv13177

Modified Files:
	emailbench.py 
Log Message:
Messages get put in OOSets, so they need an __cmp__.


=== Zope3/src/zodb/tests/emailbench.py 1.1 => 1.2 ===
--- Zope3/src/zodb/tests/emailbench.py:1.1	Mon Apr 21 14:00:42 2003
+++ Zope3/src/zodb/tests/emailbench.py	Tue Apr 22 11:19:55 2003
@@ -75,6 +75,17 @@
         self.headers = headers
         self.payload = payload
 
+    def __cmp__(self, msg):
+        # The headers and payload must be the same, but start with
+        # a simple check of the msgid.
+        x = cmp(self.msgid, msg.msgid)
+        if x:
+            return x
+        x = cmp(self.headers, msg.headers)
+        if x:
+            return x
+        return cmp(self.payload, msg.payload)
+
     def fromEmail(cls, msg):
         recipients = []
         for h in "to", "cc", "bcc":




More information about the Zodb-checkins mailing list