|
16 | 16 |
|
17 | 17 | import numpy as np
|
18 | 18 | import pandas as pd
|
19 |
| -from qiskit.tools import parallel_map |
20 | 19 |
|
21 | 20 | from qiskit_experiments.database_service.utils import ThreadSafeDataFrame
|
22 | 21 | from qiskit_experiments.framework.analysis_result_table import AnalysisResultTable
|
@@ -120,76 +119,6 @@ def test_clear_container(self):
|
120 | 119 | table.clear()
|
121 | 120 | self.assertEqual(len(table), 0)
|
122 | 121 |
|
123 |
| - def test_multi_thread_add_entry(self): |
124 |
| - """Test add entry with parallel thread access.""" |
125 |
| - table = TestBaseTable.TestTable() |
126 |
| - |
127 |
| - # Mutate thread safe table in parallel thread. No race should occur. |
128 |
| - parallel_map( |
129 |
| - _callable_thread_local_add_entry, |
130 |
| - [ |
131 |
| - ["x", {"value1": 0.0, "value2": 1.0, "value3": 2.0}], |
132 |
| - ["y", {"value1": 3.0, "value2": 4.0, "value3": 5.0}], |
133 |
| - ["z", {"value1": 6.0, "value2": 7.0, "value3": 8.0}], |
134 |
| - ], |
135 |
| - task_kwargs={"thread_table": table}, |
136 |
| - ) |
137 |
| - self.assertEqual(len(table), 3) |
138 |
| - |
139 |
| - self.assertListEqual(table.loc["x"].to_list(), [0.0, 1.0, 2.0]) |
140 |
| - self.assertListEqual(table.loc["y"].to_list(), [3.0, 4.0, 5.0]) |
141 |
| - self.assertListEqual(table.loc["z"].to_list(), [6.0, 7.0, 8.0]) |
142 |
| - |
143 |
| - def test_multi_thread_add_entry_with_new_column(self): |
144 |
| - """Test add entry with parallel thread access, each thread adds new column.""" |
145 |
| - table = TestBaseTable.TestTable() |
146 |
| - |
147 |
| - # Mutate thread safe table in parallel thread. No race should occur. |
148 |
| - parallel_map( |
149 |
| - _callable_thread_local_add_entry, |
150 |
| - [ |
151 |
| - ["x", {"value1": 0.0, "value2": 1.0, "value3": 2.0, "new_x": "x_val"}], |
152 |
| - ["y", {"value1": 3.0, "value2": 4.0, "value3": 5.0, "new_y": "y_val"}], |
153 |
| - ["z", {"value1": 6.0, "value2": 7.0, "value3": 8.0, "new_z": "z_val"}], |
154 |
| - ], |
155 |
| - task_kwargs={"thread_table": table}, |
156 |
| - ) |
157 |
| - self.assertEqual(len(table), 3) |
158 |
| - |
159 |
| - self.assertDictEqual( |
160 |
| - table.loc["x"].to_dict(), |
161 |
| - { |
162 |
| - "value1": 0.0, |
163 |
| - "value2": 1.0, |
164 |
| - "value3": 2.0, |
165 |
| - "new_x": "x_val", |
166 |
| - "new_y": None, |
167 |
| - "new_z": None, |
168 |
| - }, |
169 |
| - ) |
170 |
| - self.assertDictEqual( |
171 |
| - table.loc["y"].to_dict(), |
172 |
| - { |
173 |
| - "value1": 3.0, |
174 |
| - "value2": 4.0, |
175 |
| - "value3": 5.0, |
176 |
| - "new_x": None, |
177 |
| - "new_y": "y_val", |
178 |
| - "new_z": None, |
179 |
| - }, |
180 |
| - ) |
181 |
| - self.assertDictEqual( |
182 |
| - table.loc["z"].to_dict(), |
183 |
| - { |
184 |
| - "value1": 6.0, |
185 |
| - "value2": 7.0, |
186 |
| - "value3": 8.0, |
187 |
| - "new_x": None, |
188 |
| - "new_y": None, |
189 |
| - "new_z": "z_val", |
190 |
| - }, |
191 |
| - ) |
192 |
| - |
193 | 122 | def test_container_is_immutable(self):
|
194 | 123 | """Test modifying container doesn't mutate the original payload."""
|
195 | 124 | table = TestBaseTable.TestTable()
|
|
0 commit comments