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

Definition at line 33 of file counter_test.py.

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

Definition at line 9 of file counter_test.py.

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

Definition at line 42 of file counter_test.py.

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