|
8 | 8 | # noinspection PyProtectedMember |
9 | 9 | from flowkit._models.gating_results import GatingResults |
10 | 10 |
|
11 | | -from tests.test_config import ( |
12 | | - test_samples_8c_full_set_dict, |
13 | | - csv_8c_comp_file_path, |
14 | | - detectors_8c, |
15 | | -) |
| 11 | +from tests import test_config |
16 | 12 |
|
17 | 13 |
|
18 | 14 | class GatingStrategyRemoveGatesTestCase(unittest.TestCase): |
@@ -43,8 +39,8 @@ def setUp(self): |
43 | 39 | :return: None |
44 | 40 | """ |
45 | 41 | sample_id = "101_DEN084Y5_15_E01_008_clean.fcs" |
46 | | - sample = copy.deepcopy(test_samples_8c_full_set_dict[sample_id]) |
47 | | - comp = fk.Matrix(csv_8c_comp_file_path, detectors_8c) |
| 42 | + sample = copy.deepcopy(test_config.test_samples_8c_full_set_dict[sample_id]) |
| 43 | + comp = fk.Matrix(test_config.csv_8c_comp_file_path, test_config.detectors_8c) |
48 | 44 |
|
49 | 45 | session = fk.Session() |
50 | 46 | session.add_samples(sample) |
@@ -355,6 +351,42 @@ def test_remove_gate_keep_children(self): |
355 | 351 | # |
356 | 352 | # Rename gate tests |
357 | 353 | # |
| 354 | + def test_rename_gate_with_children(self): |
| 355 | + # This test covers the bug reported in issue #231 |
| 356 | + poly1_vertices = test_config.poly1_vertices |
| 357 | + poly1_dims = test_config.poly1_dims |
| 358 | + |
| 359 | + top1_gate = fk.gates.PolygonGate("top1", poly1_dims, poly1_vertices) |
| 360 | + top2_gate = fk.gates.PolygonGate("top2", poly1_dims, poly1_vertices) |
| 361 | + a_gate = fk.gates.PolygonGate("A", poly1_dims, poly1_vertices) |
| 362 | + a1_gate = fk.gates.PolygonGate("A1", poly1_dims, poly1_vertices) |
| 363 | + a2_gate = fk.gates.PolygonGate("A2", poly1_dims, poly1_vertices) |
| 364 | + |
| 365 | + gs = fk.GatingStrategy() |
| 366 | + gs.add_gate(top1_gate, gate_path=('root',)) |
| 367 | + gs.add_gate(top2_gate, gate_path=('root',)) |
| 368 | + |
| 369 | + gs.add_gate(a_gate, gate_path=('root', 'top1')) |
| 370 | + gs.add_gate(copy.deepcopy(a_gate), gate_path=('root', 'top2')) |
| 371 | + |
| 372 | + gs.add_gate(a1_gate, gate_path=('root', 'top1', 'A')) |
| 373 | + gs.add_gate(a2_gate, gate_path=('root', 'top1', 'A')) |
| 374 | + |
| 375 | + gs.add_gate(copy.deepcopy(a1_gate), gate_path=('root', 'top2', 'A')) |
| 376 | + gs.add_gate(copy.deepcopy(a2_gate), gate_path=('root', 'top2', 'A')) |
| 377 | + |
| 378 | + # now rename 'top1' > 'A' |
| 379 | + # This step caused a GateReferenceError prior to #231 fix |
| 380 | + gs.rename_gate('A', 'A_new', ('root', 'top1')) |
| 381 | + |
| 382 | + # verify we can retrieve the gate by its new gate name |
| 383 | + renamed_gate = gs.get_gate('A_new', gate_path=('root', 'top1')) |
| 384 | + self.assertEqual(renamed_gate.gate_name, 'A_new') |
| 385 | + |
| 386 | + # And verify the other 'A' gate name didn't change |
| 387 | + other_a_gate = gs.get_gate('A', gate_path=('root', 'top2')) |
| 388 | + self.assertEqual(other_a_gate.gate_name, 'A') |
| 389 | + |
358 | 390 | def test_rename_gate_with_bool_dep(self): |
359 | 391 | gs = copy.deepcopy(self.gating_strategy) |
360 | 392 | gate_name_to_rename = "CD3-pos-range" |
|
0 commit comments