Skip to content

Commit b6d9961

Browse files
committed
TST: check consistency of (Atom, Structure) pickle
This fails in Python 3.7.
1 parent 6191146 commit b6d9961

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/diffpy/structure/tests/teststructure.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919

2020
import copy
21+
import pickle
2122
import unittest
2223
import numpy
2324

@@ -656,6 +657,17 @@ def test_Bij(self):
656657
self.assertFalse(numpy.any(stru.U != 0.0))
657658
return
658659

660+
661+
def test_pickling(self):
662+
"""Make sure Atom in Structure can be consistently pickled.
663+
"""
664+
stru = self.stru
665+
a = stru[0]
666+
self.assertTrue(a is stru[0])
667+
a1, stru1 = pickle.loads(pickle.dumps((a, stru)))
668+
self.assertTrue(a1 is stru1[0])
669+
return
670+
659671
# End of class TestStructure
660672

661673
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)