MCPcopy
hub / github.com/wechaty/python-wechaty / test_payload_pickle

Function test_payload_pickle

tests/accessory_test.py:218–235  ·  view source on GitHub ↗

test save/load pickle payload

()

Source from the content-addressed store, hash-verified

216
217
218def test_payload_pickle():
219 """test save/load pickle payload"""
220 with tempfile.TemporaryDirectory() as tempdir:
221 contact_payload = ContactPayload(
222 id=str(uuid4()),
223 name="fake-name"
224 )
225 cache_path = os.path.join(tempdir, 'contact.pkl')
226 save_pickle_data(contact_payload, cache_path)
227
228 payload = load_pickle_data(cache_path)
229 assert payload.id == contact_payload.id
230
231 # save list
232 save_pickle_data([contact_payload], cache_path)
233 payloads = load_pickle_data(cache_path)
234 assert len(payloads) == 1
235 assert payloads[0].id == contact_payload.id

Callers

nothing calls this directly

Calls 2

save_pickle_dataFunction · 0.90
load_pickle_dataFunction · 0.90

Tested by

no test coverage detected