5 from basf2
import create_path
10 """Test case for standard V0 lists"""
14 std_function=stdV0s.stdKshorts,
23 "ParticleListManipulator"],
24 expected_lists=['V0', 'all', 'RD', 'merged']):
25 """check that a given function works"""
26 testpath = create_path()
27 std_function(path=testpath)
31 len(testpath.modules()), len(expected_modules),
32 "Function %s does not load the expected number of modules" % (std_function.__name__))
37 for module
in testpath.modules():
38 loaded_modules.append(module.type())
39 for param
in module.available_params():
40 if module.type() ==
'ParticleLoader' and param.name ==
'decayStringsWithCuts':
41 name = param.values[0][0].split(
':')[1].split(
' -> ')[0]
42 built_lists.append(name)
43 if module.type() ==
'ParticleListManipulator' and param.name ==
'outputListName':
44 name = str(param.values).split(
':')[1].split(
' -> ')[0]
45 built_lists.append(name)
46 if module.type() ==
'ParticleCombiner' and param.name ==
'decayString':
47 name = param.values.split(
':')[1].split(
' -> ')[0]
48 built_lists.append(name)
51 for a, b
in zip(loaded_modules, expected_modules):
52 self.assertEqual(a, b,
"Loaded module \'%s\' instead of \'%s\' with function %s" % (a, b, std_function.__name__))
55 for a, b
in zip(built_lists, expected_lists):
56 self.assertEqual(a, b,
"Loaded list \'%s\' instead of \'%s\' with function %s" % (a, b, std_function.__name__))
59 """check that the builder function works with the stdKshorts list"""
63 """check that the builder function works with the legacy Belle Kshorts list"""
64 expected_modules = [
"ParticleLoader",
65 "ParticleVertexFitter",
67 self.
_check_list(std_function=stdV0s.goodBelleKshort, expected_modules=expected_modules, expected_lists=[
"legacyGoodKS"])
70 """check that the builder function works with the stdLambdas list"""
71 expected_modules = [
"ParticleLoader",
74 "DuplicateVertexMarker",
81 "DuplicateVertexMarker",
83 "ParticleListManipulator"]
84 expected_lists = [
'V0',
'all',
'all',
'RD',
'merged']
85 self.
_check_list(std_function=stdV0s.stdLambdas, expected_modules=expected_modules, expected_lists=expected_lists)
88 if __name__ ==
'__main__':