bernhard: thuban/Extensions/svgexport/test test_svgmapwriter.py, 1.11, 1.12

Bernhard Herzog bh at intevation.de
Mon Dec 13 15:57:53 CET 2004


cvs at intevation.de writes:

> Index: test_svgmapwriter.py
> ===================================================================
> RCS file: /thubanrepository/thuban/Extensions/svgexport/test/test_svgmapwriter.py,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -d -r1.11 -r1.12
> --- test_svgmapwriter.py	7 Dec 2004 14:00:12 -0000	1.11
> +++ test_svgmapwriter.py	11 Dec 2004 02:03:47 -0000	1.12
> @@ -201,10 +182,55 @@
>          self.assertEquals(xmlsupport.sax_eventlist(data = data), 
>                            xmlsupport.sax_eventlist(data = file.getvalue()))
>  
> +class TestDrawSplines(TestVirtualDC):

First, do you realise that you inflate the number of tests by deriving
from a baseclass that defines test_* methods?  All tests defined in the
base class are run and counted twice!  That kind of thing can be quite
useful but it doesn't do any good in this case.

Examples where tests defined in base classes are useful in include

 - Python's test/test_sets.py

 - Thuban's mix-in TableTests and the derived classes TestPostGISTable
   and TestPostGISTableExplicitGIDColumn in test/test_postgis_db.py

> +    """Testing DrawSpline variations.
> +    See comments in DrawSpline().
> +    """
> +
> +    def setUp(self):
> +        super(TestDrawSplines,self).setUp()

I get errors at this point when running the tests with Python 2.2.1 (the
oldest python version supported by Thuban):

  File "../Extensions/svgexport/test/test_svgmapwriter.py", line 191, in setUp
    super(TestDrawSplines,self).setUp()
TypeError: super() argument 1 must be type, not class

The builtin super only works with new-style classes.  In Python 2.3,
unittest.TestCase and other classes in unittest are new-style classes,
but in 2.2 they are still "old-style" classes.

I'll change this line to the backwards compatible

  TestVirtualDC.setUp(self)


  Bernhard


-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)