Back to index

plone3  3.1.7
Public Member Functions
PortalTransforms.tests.test_transforms.TransformTest Class Reference
Inheritance diagram for PortalTransforms.tests.test_transforms.TransformTest:
Inheritance graph
[legend]
Collaboration diagram for PortalTransforms.tests.test_transforms.TransformTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def do_convert
def testSame
def testSameNoFilename
def __repr__

Detailed Description

Definition at line 28 of file test_transforms.py.


Member Function Documentation

Definition at line 78 of file test_transforms.py.

00078 
00079     def __repr__(self):
00080         return self.transform.name()

Definition at line 30 of file test_transforms.py.

00030 
00031     def do_convert(self, filename=None):
00032         if filename is None and exists(self.output + '.nofilename'):
00033             output = self.output + '.nofilename'
00034         else:
00035             output = self.output
00036         input = open(self.input)
00037         orig = input.read()
00038         input.close()
00039         data = datastream(self.transform.name())
00040         res_data = self.transform.convert(orig, data, filename=filename)
00041         self.assert_(idatastream.isImplementedBy(res_data))
00042         got = res_data.getData()
00043         try:
00044             output = open(output)
00045         except IOError:
00046             import sys
00047             print >>sys.stderr, 'No output file found.'
00048             print >>sys.stderr, 'File %s created, check it !' % self.output
00049             output = open(output, 'w')
00050             output.write(got)
00051             output.close()
00052             self.assert_(0)
00053         expected = output.read()
00054         if self.normalize is not None:
00055             expected = self.normalize(expected)
00056             got = self.normalize(got)
00057         output.close()
00058 
00059         self.assertEquals(got, expected,
00060                           '[%s]\n\n!=\n\n[%s]\n\nIN %s(%s)' % (
00061             got, expected, self.transform.name(), self.input))
00062         self.assertEquals(self.subobjects, len(res_data.getSubObjects()),
00063                           '%s\n\n!=\n\n%s\n\nIN %s(%s)' % (
00064             self.subobjects, len(res_data.getSubObjects()),
00065             self.transform.name(), self.input))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 66 of file test_transforms.py.

00066 
00067     def testSame(self):
00068         try:
00069             self.do_convert(filename=self.input)
00070         except MissingBinary, e:
00071             pass

Here is the call graph for this function:

Definition at line 72 of file test_transforms.py.

00072 
00073     def testSameNoFilename(self):
00074         try:
00075             self.do_convert()
00076         except MissingBinary, e:
00077             pass

Here is the call graph for this function:


The documentation for this class was generated from the following file: