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