[reportlab-users] unit tests in the CVS

Jerome Alet reportlab-users@reportlab.com
Mon, 7 Oct 2002 16:16:47 +0200


--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Oct 07, 2002 at 02:35:59PM +0100, Andy Robinson wrote:
> 
> It is, but we are not all testing regularly enough. I had better
> chat to my colleagues and make sure we each have a login to
> a 1.5.2 test environment, as well as fixing these bugs.
> 
> We should be able to fix these tomorrow.

For pycanvas, the attached patches *SHOULD* solve the problem
for 2.1 and 2.2 but I can't test it under 1.5.2 anymore
(I've also replaced the += and -= though)

Beware : there are two patch files

bye,

Jerome Alet

--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pycanvas.py.patch"

--- pycanvas.py	2002-10-07 16:09:24.000000000 +0200
+++ pycanvas.py.new	2002-10-07 16:09:09.000000000 +0200
@@ -1,4 +1,4 @@
-# a Pythonesque Canvas v0.6
+# a Pythonesque Canvas v0.7
 # Author : Jerome Alet - <alet@librelogiciel.com>
 # License : ReportLab's license
 #
@@ -173,9 +173,17 @@
             self._postcomment() 
         self._parent._parent._in = self._parent._parent._in + 1 
         retcode = apply(getattr(self._parent._object, self._action), args, kwargs)
-        self._parent._parent._in -= 1
+        self._parent._parent._in = self._parent._parent._in - 1
         return retcode
         
+    def __str__(self) :
+        """Needed for Python 2.1"""
+        return str(getattr(self._parent._object, self._action))
+    
+    def __coerce__(self, other) :
+        """Needed for Python 2.1"""
+        return coerce(getattr(self._parent._object, self._action), other)
+        
     def _precomment(self) : 
         """To be overriden."""
         pass
@@ -237,7 +245,7 @@
                 self._parent._PyWrite("\n    # Saves context level %i %s" % (self._parent._contextlevel, state))
                 self._parent._contextlevel = self._parent._contextlevel + 1
             elif self._action == "restoreState" :    
-                self._parent._contextlevel -= 1
+                self._parent._contextlevel = self._parent._contextlevel - 1
                 self._parent._PyWrite("\n    # Restores context level %i %s" % (self._parent._contextlevel, self._parent._object.state_stack[-1]))
             elif self._action == "beginForm" :    
                 self._parent._formnumber = self._parent._formnumber + 1
@@ -252,7 +260,7 @@
             if self._action == "showPage" :
                 self._parent._pagenumber = self._parent._pagenumber + 1
                 self._parent._PyWrite("\n    # Begins page %i" % self._parent._pagenumber)
-            elif self._action == "endForm" :    
+            elif self._action in [ "endForm", "drawPath", "clipPath" ] :    
                 self._parent._PyWrite("")
 
     _name = "c"

--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pdfmetrics.py.patch"

--- pdfmetrics.py       2002-10-07 16:15:15.000000000 +0200
+++ pdfmetrics.py.new   2002-10-07 16:14:32.000000000 +0200
@@ -565,6 +565,7 @@
 
 def getTypeFace(faceName):
     """Lazily construct known typefaces if not found"""
+    faceName = str(faceName)
     try:
         return _typefaces[faceName]
     except KeyError:

--Dxnq1zWXvFF0Q93v--