File: test_geomutils.py

package info (click to toggle)
python-reportlab 3.1.8-3%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 6,996 kB
  • ctags: 9,483
  • sloc: python: 69,727; ansic: 19,108; xml: 1,494; makefile: 416; java: 193; sh: 100
file content (32 lines) | stat: -rw-r--r-- 957 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
__version__='''$Id$'''
__doc__="""Tests for geometry utility functions."""

import unittest
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses
setOutDir(__name__)

class GeomTestCase(unittest.TestCase):

    def test_padding(self):
        "Test reportlab.lib.boxstuff.normalizePadding."
        from reportlab.lib.geomutils import normalizeTRBL

        paddings = (
            (4, (4, 4, 4, 4)),
            ((0, 1), (0, 1, 0, 1)),
            ((0, 1, 2), (0, 1, 2, 1)),
            ((0, 1, 2, 3), (0, 1, 2, 3)),
        )
        
        for pin, pout in paddings:
            pres = normalizeTRBL(pin)
            assert pres == pout, "normalizeTRBL(%s) returned %s, expected %s" % (pin, pres, pout)

def makeSuite():
    return makeSuiteForClasses(GeomTestCase)

if __name__ == "__main__":
    unittest.TextTestRunner().run(makeSuite())