Belle II Software development
TestGetComparison Class Reference
Inheritance diagram for TestGetComparison:

Public Member Functions

def setUp (self)
 
def test_get_comparison (self)
 

Public Attributes

 test_options
 Mapping test case -> Metaoptions.
 

Detailed Description

 Test get_comparison 

Definition at line 24 of file test_comparison.py.

Member Function Documentation

◆ setUp()

def setUp (   self)
 Set up testing of get_comparison 

Definition at line 27 of file test_comparison.py.

27 def setUp(self):
28 """ Set up testing of get_comparison """
29
30 self.test_options = {
31 "chi2": "",
32 "kolmogorov": "kolmogorov",
33 "andersondarling": "andersondarling",
34 }
35 gaus_th1f = ROOT.TH1F("gaus", "gaus", 5, -3, 3)
36 gaus_th1f.FillRandom("gaus", 1000)
37 exponential_th1f = ROOT.TH1F("expo", "expo", 5, -3, 3)
38 exponential_th1f.FillRandom("expo", 1000)
39
40 self.obj_pairs: List[Tuple[ROOT.TObject, ROOT.TObject, str]] = [
41 (gaus_th1f, gaus_th1f, "equal"),
42 (gaus_th1f, exponential_th1f, "error"),
43 ]
44

◆ test_get_comparison()

def test_get_comparison (   self)
 Use get_tester on the metaoptions to get the requested
comparison object and run that on two identical ROOT object.
Check that this indeed returns 'equal'.

Definition at line 45 of file test_comparison.py.

45 def test_get_comparison(self):
46 """ Use get_tester on the metaoptions to get the requested
47 comparison object and run that on two identical ROOT object.
48 Check that this indeed returns 'equal'.
49 """
50 for tester_name in self.test_options:
51 for objs in self.obj_pairs:
52 names: Tuple[str, str] = (objs[0].GetName(), objs[1].GetName())
53 with self.subTest(
54 tester=tester_name, obj1=names[0], obj2=names[1],
55 ):
56 tester = validationcomparison.get_comparison(
57 objs[0],
58 objs[1],
60 self.test_options[tester_name].split(",")
61 ),
62 )
63 print(
64 f"{names[0]}, {names[1]}: "
65 f"{tester.comparison_result_long}. "
66 f"Short result: {tester.comparison_result}. "
67 f"Expectation: {objs[2]}"
68 )
69 self.assertEqual(tester.comparison_result, objs[2])
70
71

Member Data Documentation

◆ test_options

test_options

Mapping test case -> Metaoptions.

Definition at line 30 of file test_comparison.py.


The documentation for this class was generated from the following file: