cti-python-stix2/stix2/test/v20/test_pickle.py

20 lines
361 B
Python
Raw Normal View History

2018-06-06 21:30:45 +02:00
import pickle
import stix2
from .constants import IDENTITY_ID
2018-06-06 21:30:45 +02:00
def test_pickling():
"""
Ensure a pickle/unpickle cycle works okay.
"""
identity = stix2.v20.Identity(
id=IDENTITY_ID,
2018-06-06 21:30:45 +02:00
name="alice",
description="this is a pickle test",
identity_class="some_class",
2018-06-06 21:30:45 +02:00
)
pickle.loads(pickle.dumps(identity))