[Zope3-checkins] CVS: zopeproducts/demo/messageboard/step6/tests -
test_size.py:1.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Dec 14 17:13:04 EST 2003
Update of /cvs-repository/zopeproducts/demo/messageboard/step6/tests
In directory cvs.zope.org:/tmp/cvs-serv24365/tests
Modified Files:
test_size.py
Log Message:
Fix tests.
=== zopeproducts/demo/messageboard/step6/tests/test_size.py 1.2 => 1.3 ===
--- zopeproducts/demo/messageboard/step6/tests/test_size.py:1.2 Fri Jul 11 09:55:20 2003
+++ zopeproducts/demo/messageboard/step6/tests/test_size.py Sun Dec 14 17:13:03 2003
@@ -17,12 +17,13 @@
"""
import unittest
from zope.app.interfaces.size import ISized
+from zope.app.tests.placelesssetup import PlacelessSetup
from zopeproducts.messageboard.message import Message, MessageSized
class Stub:
pass
-class SizedTest(unittest.TestCase):
+class SizedTest(PlacelessSetup, unittest.TestCase):
def test_interface(self):
self.assert_(ISized.isImplementedBy(MessageSized(Message())))
@@ -30,9 +31,9 @@
def test_sizeForSorting(self):
size = MessageSized(Message())
self.assertEqual(('item', 0), size.sizeForSorting())
- size._message.setObject('msg1', Message())
+ size._message['msg1'] = Message()
self.assertEqual(('item', 1), size.sizeForSorting())
- size._message.setObject('att1', Stub())
+ size._message['att1'] = Stub()
self.assertEqual(('item', 2), size.sizeForSorting())
def test_sizeForDisplay(self):
@@ -41,22 +42,22 @@
str(size.sizeForDisplay()))
self.assertEqual({'attach': '0', 'messages': '0'},
size.sizeForDisplay().mapping)
- size._message.setObject('msg1', Message())
+ size._message['msg1'] = Message()
self.assertEqual('1 reply, ${attach} attachments',
size.sizeForDisplay())
self.assertEqual({'attach': '0', 'messages': '1'},
size.sizeForDisplay().mapping)
- size._message.setObject('msg2', Message())
+ size._message['msg2'] = Message()
self.assertEqual('${messages} replies, ${attach} attachments',
size.sizeForDisplay())
self.assertEqual({'attach': '0', 'messages': '2'},
size.sizeForDisplay().mapping)
- size._message.setObject('att1', Stub())
+ size._message['att1'] = Stub()
self.assertEqual('${messages} replies, 1 attachment',
size.sizeForDisplay())
self.assertEqual({'attach': '1', 'messages': '2'},
size.sizeForDisplay().mapping)
- size._message.setObject('att2', Stub())
+ size._message['att2'] = Stub()
self.assertEqual('${messages} replies, ${attach} attachments',
str(size.sizeForDisplay()))
self.assertEqual({'attach': '2', 'messages': '2'},
More information about the Zope3-Checkins
mailing list