Skip to content

Commit 4ffcab3

Browse files
committed
Adding back a simulation pickle test
Ensuring pickling works is needed on the backend.
1 parent f766aef commit 4ffcab3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

requirements/dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ pytest
1111
pytest-timeout
1212
gdspy
1313
memory_profiler
14+
dill

tests/test_IO.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import xarray as xr
1010
import h5py
1111
from dask.base import tokenize
12+
import dill as pickle
1213

1314

1415
from tidy3d import *
@@ -52,6 +53,17 @@ def test_simulation_load_export_hdf5():
5253
assert SIM == SIM2, "original and loaded simulations are not the same"
5354

5455

56+
@clear_tmp
57+
def test_simulation_load_export_pckl():
58+
59+
path = "tests/tmp/simulation.pckl"
60+
with open(path, "wb") as pickle_file:
61+
pickle.dump(SIM, pickle_file)
62+
with open(path, "rb") as pickle_file:
63+
SIM2 = pickle.load(pickle_file)
64+
assert SIM == SIM2, "original and loaded simulations are not the same"
65+
66+
5567
@clear_tmp
5668
def test_simulation_preserve_types():
5769
"""Test that all re-loaded components have the same types."""

0 commit comments

Comments
 (0)