CMS 3D CMS Logo

List of all members | Public Member Functions
counter_test.CounterTestCase Class Reference
Inheritance diagram for counter_test.CounterTestCase:

Public Member Functions

def test_add (self)
 
def test_bad_add (self)
 
def test_simple (self)
 
def test_write (self)
 

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  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])
33 
def counter_test.CounterTestCase.test_bad_add (   self)

Definition at line 34 of file counter_test.py.

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)
42 
def counter_test.CounterTestCase.test_simple (   self)

Definition at line 10 of file counter_test.py.

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])
19 
def counter_test.CounterTestCase.test_write (   self)

Definition at line 43 of file counter_test.py.

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 
59