[Zope3-checkins] CVS: Zope3/src/zope/app/tests - test_size.py:1.3

Steve Alexander steve@cat-box.net
Fri, 27 Dec 2002 14:19:11 -0500


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

Modified Files:
	test_size.py 
Log Message:
implemented a useful ISized adapter for images, which gives you the
size in bytes, and the width and height, and sorts on size in bytes.


=== Zope3/src/zope/app/tests/test_size.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/tests/test_size.py:1.2	Fri Dec 27 13:22:59 2002
+++ Zope3/src/zope/app/tests/test_size.py	Fri Dec 27 14:19:10 2002
@@ -68,7 +68,14 @@
         sized = DefaultSized(DummyObject(2000000))
         self.assertEqual(sized.sizeForSorting(), ('byte', 2000000))
         self.assertEqual(sized.sizeForDisplay(), u'1.91 MB')
-    
+
+    def test_byteDisplay(self):
+        from zope.app.size import byteDisplay
+        self.assertEqual(byteDisplay(0), u'0 KB')
+        self.assertEqual(byteDisplay(1), u'1 KB')
+        self.assertEqual(byteDisplay(2048), u'2 KB')
+        self.assertEqual(byteDisplay(2000000), u'1.91 MB')
+
 def test_suite():
     loader = unittest.TestLoader()
     return loader.loadTestsFromTestCase(Test)