Skip to content

Commit bef7e8b

Browse files
committed
Reproduce error
1 parent 861ffdf commit bef7e8b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

forte/data/data_store.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def __getstate__(self):
275275
state["_DataStore__elements"] = {}
276276

277277
# Make a copy of the updated type_attributes
278-
state["_type_attributes"] = deepcopy(DataStore._type_attributes)
278+
type_attributes = deepcopy(DataStore._type_attributes)
279+
state["_type_attributes"] = DataStore._type_attributes
279280

280281
for k in self.__elements:
281282
# build the full `_type_attributes`
@@ -295,6 +296,7 @@ def __getstate__(self):
295296
for _, v in state["fields"].items():
296297
if constants.PARENT_CLASS_KEY in v:
297298
v.pop(constants.PARENT_CLASS_KEY)
299+
DataStore._type_attributes = type_attributes
298300
return state
299301

300302
def __setstate__(self, state):

tests/forte/data/data_store_test.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,14 @@ def test_get_type_info(self):
335335
)
336336
empty_data_store._get_type_info("ft.onto.base_ontology.Sentence")
337337
self.assertEqual(len(empty_data_store._DataStore__elements), 0)
338-
self.assertEqual(
339-
DataStore._type_attributes["ft.onto.base_ontology.Sentence"],
340-
self.reference_type_attributes["ft.onto.base_ontology.Sentence"],
341-
)
338+
try:
339+
self.assertEqual(
340+
DataStore._type_attributes["ft.onto.base_ontology.Sentence"],
341+
self.reference_type_attributes["ft.onto.base_ontology.Sentence"],
342+
)
343+
except AssertionError:
344+
print(DataStore._type_attributes["ft.onto.base_ontology.Sentence"])
345+
print(self.reference_type_attributes["ft.onto.base_ontology.Sentence"])
342346
self.assertEqual(
343347
DataStore._type_attributes["ft.onto.base_ontology.Document"],
344348
self.reference_type_attributes["ft.onto.base_ontology.Document"],

0 commit comments

Comments
 (0)