[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container/tests - test_contents.py:1.3
Steve Alexander
steve@cat-box.net
Fri, 27 Dec 2002 10:23:22 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/container/tests
In directory cvs.zope.org:/tmp/cvs-serv15314/src/zope/app/browser/container/tests
Modified Files:
test_contents.py
Log Message:
implemented the size stuff from http://collector.zope.org/Zope3-dev/108
=== Zope3/src/zope/app/browser/container/tests/test_contents.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/container/tests/test_contents.py:1.2 Wed Dec 25 09:12:30 2002
+++ Zope3/src/zope/app/browser/container/tests/test_contents.py Fri Dec 27 10:22:51 2002
@@ -77,8 +77,7 @@
from datetime import datetime
from zope.app.interfaces.dublincore import IZopeDublinCore
- from zope.app.browser.container.contents \
- import formatTime, getSize
+ from zope.app.browser.container.contents import formatTime
class FauxDCAdapter:
__implements__ = IZopeDublinCore
@@ -89,8 +88,7 @@
created = datetime(2001, 1, 1, 1, 1, 1)
modified = datetime(2002, 2, 2, 2, 2, 2)
- from zope.component.adapter \
- import provideAdapter
+ from zope.component.adapter import provideAdapter
provideAdapter(IDocument, IZopeDublinCore, FauxDCAdapter)
fc = self._TestView__newView( container )
@@ -100,24 +98,8 @@
self.assertEqual(info['url'], 'document')
self.assertEqual(info['object'], document)
self.assertEqual(info['title'], 'faux title')
- size,label=info['size']['size'],info['size']['label']
- self.assertEqual((size,label), getSize(FauxDCAdapter.size))
self.assertEqual(info['created'], formatTime(FauxDCAdapter.created))
self.assertEqual(info['modified'], formatTime(FauxDCAdapter.modified))
-
- def testObjectSize(self):
- from zope.app.browser.container.contents import getSize
- class SizeableObject:
- def __init__(self, size=0):
- self.size=size
- def getSize(self):
- return self.size
- self.assertEqual(getSize(SizeableObject(0)), (0, u'1 KB') )
- self.assertEqual(getSize(SizeableObject(2048)), (2048, u'2 KB') )
- self.assertEqual(getSize(SizeableObject(2000000)),(2000000,u'1.91 MB'))
- self.assertEqual(getSize(SizeableObject('bob')), (0,u'N/A'))
- self.assertEqual(getSize('dobbs'), (0,u'N/A'))
-
def testRemove( self ):
container = self._TestView__newContext()