Skip to content

Commit e5a1223

Browse files
committed
Fix reference physics list registry test
1 parent e027857 commit e5a1223

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

opengate/tests/src/physics/test099_physics_list_registry.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import opengate_core as g4
55

6-
from opengate.managers import (
7-
PhysicsListManager,
6+
from opengate.managers import PhysicsListManager
7+
from opengate.physicslists import (
88
create_reference_physics_list_class,
99
reference_physics_list_base_class_names,
1010
)
@@ -14,18 +14,17 @@
1414
def check_pybind_reference_classes_against_factory(factory):
1515
is_ok = True
1616

17-
factory_names = set(factory.AvailablePhysLists())
18-
pybind_names = {
19-
name for name in reference_physics_list_base_class_names if hasattr(g4, name)
20-
}
17+
factory_names = {str(name) for name in factory.AvailablePhysLists()}
18+
expected_bound_names = set(reference_physics_list_base_class_names)
19+
pybind_names = {name for name in expected_bound_names if hasattr(g4, name)}
2120

22-
missing_pybind_names = sorted(factory_names - pybind_names)
21+
missing_pybind_names = sorted(expected_bound_names - pybind_names)
2322
extra_pybind_names = sorted(pybind_names - factory_names)
2423

2524
b = len(missing_pybind_names) == 0
2625
print_test(
2726
b,
28-
f"All Geant4 factory base physics lists are exposed via pybind. Missing: {missing_pybind_names}",
27+
f"All expected base reference physics lists are exposed via pybind. Missing: {missing_pybind_names}",
2928
)
3029
is_ok = b and is_ok
3130

@@ -36,7 +35,7 @@ def check_pybind_reference_classes_against_factory(factory):
3635
)
3736
is_ok = b and is_ok
3837

39-
for name in sorted(factory_names):
38+
for name in sorted(expected_bound_names):
4039
b = hasattr(g4, name)
4140
print_test(b, f"Reference physics list '{name}' is bound in opengate_core")
4241
is_ok = b and is_ok

0 commit comments

Comments
 (0)