Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
PhysicsTools
HeppyCore
python
statistics
average_test.py
Go to the documentation of this file.
1
import
unittest
2
3
from
average
import
Average
4
5
class
AverageTestCase
(unittest.TestCase):
6
7
def
test_ave_unw
(self):
8
c =
Average
(
'TestAve'
)
9
c.add( 1, 1 )
10
c.add( 2, 1 )
11
ave, unc = c.average()
12
self.assertEqual(ave, 1.5)
13
14
def
test_ave_wei
(self):
15
c =
Average
(
'TestAve'
)
16
c.add( 0, 1 )
17
c.add( 1, 3 )
18
ave, unc = c.average()
19
self.assertEqual(ave, 0.75)
20
21
def
test_ave_add
(self):
22
c1 =
Average
(
'c1'
)
23
c1.add(0,1)
24
c2 =
Average
(
'c2'
)
25
c2.add(1,3)
26
c3 = c1 + c2
27
ave, unc = c3.average()
28
self.assertEqual(ave, 0.75)
29
30
if
__name__ ==
'__main__'
:
31
unittest.main()
average.Average
Definition:
average.py:8
average_test.AverageTestCase.test_ave_add
def test_ave_add
Definition:
average_test.py:21
average_test.AverageTestCase
Definition:
average_test.py:5
average_test.AverageTestCase.test_ave_unw
def test_ave_unw
Definition:
average_test.py:7
average_test.AverageTestCase.test_ave_wei
def test_ave_wei
Definition:
average_test.py:14
Generated for CMSSW Reference Manual by
1.8.5