test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 7 of file counter_test.py.

Member Function Documentation

def counter_test.CounterTestCase.test_add (   self)

Definition at line 19 of file counter_test.py.

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

Definition at line 33 of file counter_test.py.

33 
34  def test_bad_add(self):
35  c = Counter('Test')
36  c.register('a')
37  c.register('b')
38  c.inc('a')
39  d = Counter('Test')
40  d.register('b')
41  self.assertRaises(ValueError, d.__iadd__, c)
def counter_test.CounterTestCase.test_simple (   self)

Definition at line 9 of file counter_test.py.

9 
10  def test_simple(self):
11  c = Counter('Test')
12  c.register('a')
13  c.register('b')
14  c.inc('a')
15  self.assertEqual(c['a'], ['a', 1])
16  self.assertEqual(c['b'], ['b', 0])
17  c.inc('a')
18  self.assertEqual(c['a'], ['a', 2])
def counter_test.CounterTestCase.test_write (   self)

Definition at line 42 of file counter_test.py.

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