~ubuntu-branches/ubuntu/vivid/python-reportlab/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/test_renderSVG.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-01-12 02:16:21 UTC
  • mfrom: (1.2.9) (4.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20140112021621-f4mpp5qaj1dkq2yb
Tags: 2.8~20140112-1
* New upstream snapshot.
* Build python3 packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
3
3
setOutDir(__name__)
4
 
import sys, string
 
4
import sys
5
5
from xml.dom import minidom
6
6
from xml.sax._exceptions import SAXReaderNotAvailable
7
7
import unittest
18
18
        warnings.warn(msg)
19
19
    else:
20
20
        # should better also be printed only once...
21
 
        print msg
 
21
        print(msg)
22
22
 
23
23
# Check if we have a default XML parser available or not.
24
24
try:
57
57
        fg = svg.getElementsByTagName('g')[0]           # flipping group
58
58
        dg = fg.getElementsByTagName('g')[0]            # diagram group
59
59
        textChildren = dg.getElementsByTagName('text')  # text nodes
60
 
        t0 = string.strip(textChildren[0].childNodes[0].nodeValue)
61
 
        t1 = string.strip(textChildren[1].childNodes[0].nodeValue)
 
60
        t0 = textChildren[0].childNodes[0].nodeValue.strip()
 
61
        t1 = textChildren[1].childNodes[0].nodeValue.strip()
62
62
        assert t0 == 'foo'
63
63
        assert t1 == 'bar'
64
64
 
83
83
        dg = fg.getElementsByTagName('g')[0]            # diagram group
84
84
        g = dg.getElementsByTagName('g')[0]             # custom group
85
85
        textChildren = g.getElementsByTagName('text')   # text nodes
86
 
        t0 = string.strip(textChildren[0].childNodes[0].nodeValue)
87
 
        t1 = string.strip(textChildren[1].childNodes[0].nodeValue)
 
86
        t0 = textChildren[0].childNodes[0].nodeValue.strip()
 
87
        t1 = textChildren[1].childNodes[0].nodeValue.strip()
88
88
 
89
89
        assert t0 == 'foo'
90
90
        assert t1 == 'bar'
112
112
        dg = fg.getElementsByTagName('g')[0]            # diagram group
113
113
        g = dg.getElementsByTagName('g')[0]             # custom group
114
114
        textChildren = g.getElementsByTagName('text')   # text nodes
115
 
        t0 = string.strip(textChildren[0].childNodes[0].nodeValue)
116
 
        t1 = string.strip(textChildren[1].childNodes[0].nodeValue)
 
115
        t0 = textChildren[0].childNodes[0].nodeValue.strip()
 
116
        t1 = textChildren[1].childNodes[0].nodeValue.strip()
117
117
 
118
118
        assert t0 == 'foo'
119
119
        assert t1 == 'bar'
193
193
        fg = svg.getElementsByTagName('g')[0]           # flipping group
194
194
        dg = fg.getElementsByTagName('g')[0]            # diagram group
195
195
        textChildren = dg.getElementsByTagName('text')  # text nodes
196
 
        t0 = string.strip(textChildren[0].childNodes[0].nodeValue)
197
 
        t1 = string.strip(textChildren[1].childNodes[0].nodeValue)
198
 
        assert t0 == 'foo'+specialChar
 
196
        t0 = textChildren[0].childNodes[0].nodeValue.strip()
 
197
        t1 = textChildren[1].childNodes[0].nodeValue.strip()
 
198
        assert t0 == 'foo'+specialChar, "%s should equal %s" % (ascii(t0),ascii('foo'+specialChar))
199
199
        assert t1 == 'bar'
200
200
 
201
201
    def tearDown(self):