CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
counter_test.CounterTestCase Class Reference
Inheritance diagram for counter_test.CounterTestCase:

Public Member Functions

def test_add
 
def test_bad_add
 
def test_simple
 
def test_write
 

Detailed Description

Definition at line 8 of file counter_test.py.

Member Function Documentation

def counter_test.CounterTestCase.test_add (   self)

Definition at line 20 of file counter_test.py.

20 
21  def test_add(self):
22  c = Counter('Test')
23  c.register('a')
24  c.register('b')
25  c.inc('a')
26  d = Counter('Test')
27  d.register('a')
28  d.register('b')
29  d.inc('a')
30  d.inc('b')
31  d += c
32  self.assertEqual(d['a'], ['a', 2])
33  self.assertEqual(d['b'], ['b', 1])
std::function< unsigned int(align::ID)> Counter
def counter_test.CounterTestCase.test_bad_add (   self)

Definition at line 34 of file counter_test.py.

34 
35  def test_bad_add(self):
36  c = Counter('Test')
37  c.register('a')
38  c.register('b')
39  c.inc('a')
40  d = Counter('Test')
41  d.register('b')
42  self.assertRaises(ValueError, d.__iadd__, c)
std::function< unsigned int(align::ID)> Counter
def counter_test.CounterTestCase.test_simple (   self)

Definition at line 10 of file counter_test.py.

10 
11  def test_simple(self):
12  c = Counter('Test')
13  c.register('a')
14  c.register('b')
15  c.inc('a')
16  self.assertEqual(c['a'], ['a', 1])
17  self.assertEqual(c['b'], ['b', 0])
18  c.inc('a')
19  self.assertEqual(c['a'], ['a', 2])
std::function< unsigned int(align::ID)> Counter
def counter_test.CounterTestCase.test_write (   self)

Definition at line 43 of file counter_test.py.

43 
44  def test_write(self):
45  c = Counter('Test')
46  c.register('a')
47  c.register('b')
48  c.inc('a')
49  dirname = 'test_dir'
50  if os.path.exists(dirname):
51  shutil.rmtree(dirname)
52  os.mkdir(dirname)
53  c.write(dirname)
54  shutil.rmtree(dirname)
55 
56 
57 
58 
59 
std::function< unsigned int(align::ID)> Counter