diff options
author | Just van Rossum <just@letterror.com> | 2004-11-12 08:34:32 (GMT) |
---|---|---|
committer | Just van Rossum <just@letterror.com> | 2004-11-12 08:34:32 (GMT) |
commit | 48ecaccf9e2abd230b5745edc829118a1c526b64 (patch) | |
tree | 9fcdec14f583a42afad190839405ec6fbe429b08 /Lib/test/test_plistlib.py | |
parent | b84330d3688e2bb380f21587bd7141572ac749d8 (diff) | |
download | cpython-48ecaccf9e2abd230b5745edc829118a1c526b64.zip cpython-48ecaccf9e2abd230b5745edc829118a1c526b64.tar.gz cpython-48ecaccf9e2abd230b5745edc829118a1c526b64.tar.bz2 |
testing control chars and non-dict root objects
Diffstat (limited to 'Lib/test/test_plistlib.py')
-rw-r--r-- | Lib/test/test_plistlib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py index b2a3b7d..bf745d3 100644 --- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -164,6 +164,22 @@ class TestPlistlib(unittest.TestCase): pl2 = plistlib.readPlist(StringIO(f.getvalue())) self.assertEqual(dict(pl), dict(pl2)) + def test_controlcharacters(self): + # chars in the range 0..31 are replaced by '?', except for + # \r, \n and \t since they aren't legal XML characters + testString = "".join([chr(i) for i in range(32)]) + expectedResult = '?????????\t\n??\n??????????????????' + xml = plistlib.writePlistToString(testString) + result = plistlib.readPlistFromString(xml) + self.assertEqual(result, expectedResult) + + def test_nondictroot(self): + test1 = "abc" + test2 = [1, 2, 3, "abc"] + result1 = plistlib.readPlistFromString(plistlib.writePlistToString(test1)) + result2 = plistlib.readPlistFromString(plistlib.writePlistToString(test2)) + self.assertEqual(test1, result1) + self.assertEqual(test2, result2) def test_main(): |