summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2020-10-20 07:26:33 (GMT)
committerGitHub <noreply@github.com>2020-10-20 07:26:33 (GMT)
commit3185267400be853404f22a1e06bb9fe1210735c7 (patch)
treec3f3df6b68c8c2e54a83b05af2fb41efaa81fa94 /Lib/test
parent109826c8508dd02e06ae0f1784f1d202495a8680 (diff)
downloadcpython-3185267400be853404f22a1e06bb9fe1210735c7.zip
cpython-3185267400be853404f22a1e06bb9fe1210735c7.tar.gz
cpython-3185267400be853404f22a1e06bb9fe1210735c7.tar.bz2
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_plistlib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index cb071da..c9dce00 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -498,6 +498,19 @@ class TestPlistlib(unittest.TestCase):
self.assertRaises(ValueError, plistlib.loads,
b"<plist><integer>not real</integer></plist>")
+ def test_integer_notations(self):
+ pl = b"<plist><integer>456</integer></plist>"
+ value = plistlib.loads(pl)
+ self.assertEqual(value, 456)
+
+ pl = b"<plist><integer>0xa</integer></plist>"
+ value = plistlib.loads(pl)
+ self.assertEqual(value, 10)
+
+ pl = b"<plist><integer>0123</integer></plist>"
+ value = plistlib.loads(pl)
+ self.assertEqual(value, 123)
+
def test_xml_encodings(self):
base = TESTDATA[plistlib.FMT_XML]