예제 #1
0
    def test_serialize_plist(self):
        data = {"foo": "bar"}
        serialized = plist.serialize(data)
        expected = (
            b'<?xml version="1.0" encoding="UTF-8"?>\n'
            b'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'
            b'<plist version="1.0">\n'
            b"<dict>\n"
            b"\t<key>foo</key>\n"
            b"\t<string>bar</string>\n"
            b"</dict>\n"
            b"</plist>\n")
        assert serialized == expected, serialized

        deserialized = plist.deserialize(serialized)
        assert deserialized == data, deserialized
예제 #2
0
    def test_serialize_binary_plist(self):
        data = {"foo": "bar"}
        serialized = plist.serialize(data, fmt="FMT_BINARY")

        deserialized = plist.deserialize(serialized)
        assert deserialized == data, deserialized