test_utils.py: add test of encode/decode_label functions py33
authorrobin
Wed, 27 Nov 2013 16:36:22 +0000
branchpy33
changeset 3852 8318d362cddf
parent 3851 f7397fb50684
child 3853 b0e7b6056117
test_utils.py: add test of encode/decode_label functions
tests/test_utils.py
--- a/tests/test_utils.py	Wed Nov 27 16:35:51 2013 +0000
+++ b/tests/test_utils.py	Wed Nov 27 16:36:22 2013 +0000
@@ -6,11 +6,11 @@
 from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
 setOutDir(__name__)
 import unittest
+from reportlab.lib.utils import FmtSelfDict, encode_label, decode_label
 
 class FmtTestCase(unittest.TestCase):
 
     def testFmt(self):
-        from reportlab.lib.utils import FmtSelfDict
         class MixedIn(FmtSelfDict):
             def __init__(self):
                 self.a = 'AA'
@@ -25,6 +25,9 @@
             obj._fmt('moon %(a)s june%(_b)s spoon %%(a)s%(c)s %(d)s', c='CC', C='boon', d='ni'))
         self.assertRaises(AttributeError, obj._fmt, '%(c)s')  # XXX bit weird, can this be changed?
 
+    def testLabelCoding(self):
+        a = (1,2,[3,4],"a"), [1,2,"4",b'4']
+        assert a == decode_label(encode_label(a))
 
 def makeSuite():
     return makeSuiteForClasses(FmtTestCase)