◐ Shell
clean mode source ↗

[3.8] Slightly improve plistlib test coverage. (GH-17025) by bigfootjon · Pull Request #17028 · python/cpython

Expand Up @@ -505,6 +505,26 @@ def test_xml_encodings(self): pl2 = plistlib.loads(data) self.assertEqual(dict(pl), dict(pl2))
def test_dump_invalid_format(self): with self.assertRaises(ValueError): plistlib.dumps({}, fmt="blah")
def test_load_invalid_file(self): with self.assertRaises(plistlib.InvalidFileException): plistlib.loads(b"these are not plist file contents")
def test_modified_uid_negative(self): neg_uid = UID(1) neg_uid.data = -1 # dodge the negative check in the constructor with self.assertRaises(ValueError): plistlib.dumps(neg_uid, fmt=plistlib.FMT_BINARY)
def test_modified_uid_huge(self): huge_uid = UID(1) huge_uid.data = 2 ** 64 # dodge the size check in the constructor with self.assertRaises(OverflowError): plistlib.dumps(huge_uid, fmt=plistlib.FMT_BINARY)

class TestBinaryPlistlib(unittest.TestCase):
Expand Down Expand Up @@ -748,9 +768,5 @@ def test__all__(self): support.check__all__(self, plistlib, blacklist=blacklist)

def test_main(): support.run_unittest(TestPlistlib, TestPlistlibDeprecated, TestKeyedArchive, MiscTestCase)

if __name__ == '__main__': test_main() unittest.main()