/
test_resultsandestimate.py
35 lines (26 loc) · 1.29 KB
/
test_resultsandestimate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pickle
import unittest
import pygsti
from ..testutils import BaseTestCase, compare_files, temp_files
# This class is for unifying some models that get used in this file and in testGateSets2.py
class ResultsEstimateTestCase(BaseTestCase):
def setUp(self):
super(ResultsEstimateTestCase, self).setUp()
@unittest.skip("need to update legacyio.py")
def test_load_old_results(self):
#pygsti.baseobjs.results.enable_old_python_results_unpickling()
with pygsti.io.enable_old_object_unpickling():
with open(compare_files + "/pygsti0.9.6.results.pkl", 'rb') as f:
results = pickle.load(f)
#pygsti.baseobjs.results.disable_old_python_results_unpickling()
#pygsti.io.disable_old_object_unpickling()
with open(temp_files + "/repickle_old_results.pkl", 'wb') as f:
#pickle.dump(results.estimates['TP'].models['single'], f) # Debug
pickle.dump(results, f)
with pygsti.io.enable_old_object_unpickling("0.9.7"):
with open(compare_files + "/pygsti0.9.7.results.pkl", 'rb') as f:
results = pickle.load(f)
with open(temp_files + "/repickle_old_results.pkl", 'wb') as f:
pickle.dump(results, f)
if __name__ == '__main__':
unittest.main(verbosity=2)