[Zope3-checkins] CVS: Zope3/src/zope/app/file/tests -
test_image.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Mar 18 22:18:11 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/file/tests
In directory cvs.zope.org:/tmp/cvs-serv2488/src/zope/app/file/tests
Modified Files:
test_image.py
Log Message:
Modernized the File and Image API to rely more heavily on schemas instead of
accessor and mutator methods. Removed a lot of unnecessary cruft from the
object classes and their views.
=== Zope3/src/zope/app/file/tests/test_image.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/file/tests/test_image.py:1.4 Fri Mar 5 17:09:04 2004
+++ Zope3/src/zope/app/file/tests/test_image.py Thu Mar 18 22:17:40 2004
@@ -15,7 +15,6 @@
$Id$
"""
-
import unittest
from zope.interface.verify import verifyClass
from zope.app.file.interfaces import IImage
@@ -49,13 +48,13 @@
def testEmpty(self):
file = self._makeImage()
- self.assertEqual(file.getContentType(), '')
- self.assertEqual(file.getData(), '')
+ self.assertEqual(file.contentType, '')
+ self.assertEqual(file.data, '')
def testConstructor(self):
file = self._makeImage('Data')
- self.assertEqual(file.getContentType(), '')
- self.assertEqual(file.getData(), 'Data')
+ self.assertEqual(file.contentType, '')
+ self.assertEqual(file.data, 'Data')
def testMutators(self):
# XXX What's the point of this test? Does it test that data
@@ -64,15 +63,16 @@
file = self._makeImage()
- file.setContentType('text/plain')
- self.assertEqual(file.getContentType(), 'text/plain')
+ file.contentType = 'text/plain'
+ self.assertEqual(file.contentType, 'text/plain')
- file.setData('Foobar')
- self.assertEqual(file.getData(), 'Foobar')
+ file._setData('Foobar')
+ self.assertEqual(file.data, 'Foobar')
- file.edit('Blah', 'text/html')
- self.assertEqual(file.getContentType(), 'text/html')
- self.assertEqual(file.getData(), 'Blah')
+ file.data = 'Blah'
+ file.contentType = 'text/html'
+ self.assertEqual(file.contentType, 'text/html')
+ self.assertEqual(file.data, 'Blah')
def testInterface(self):
self.failUnless(IImage.implementedBy(Image))
@@ -86,7 +86,8 @@
def test_ReadFile(self):
file = self._makeFile()
content = "This is some file\ncontent."
- file.edit(content, 'text/plain')
+ file.data = content
+ file.contentType = 'text/plain'
self.assertEqual(FileReadFile(file).read(), content)
self.assertEqual(FileReadFile(file).size(), len(content))
@@ -94,7 +95,7 @@
file = self._makeFile()
content = "This is some file\ncontent."
FileWriteFile(file).write(content)
- self.assertEqual(file.getData(), content)
+ self.assertEqual(file.data, content)
class DummyImage:
More information about the Zope3-Checkins
mailing list