~bertrand-rousseau/gtg/new-task-list-layout

« back to all changes in this revision

Viewing changes to GTG/tests/test_bidict.py

  • Committer: Bertrand Rousseau
  • Date: 2012-07-13 17:24:28 UTC
  • mfrom: (1178.1.28 trunk)
  • mto: (1178.1.30 trunk)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: bertrand.rousseau@gmail.com-20120713172428-ou3ic646fccov41d
Merge with trunk. Fixes conflict with CHANGELOG.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
# -----------------------------------------------------------------------------
19
19
 
20
 
'''
21
 
Tests for the BiDict class
22
 
'''
 
20
""" Tests for the BiDict class """
23
21
 
24
22
import unittest
25
23
import uuid
27
25
from GTG.tools.bidict import BiDict
28
26
 
29
27
 
30
 
 
31
28
class TestBiDict(unittest.TestCase):
32
 
    '''
33
 
    Tests for the BiDict object.
34
 
    '''
 
29
    """ Tests for the BiDict object."""
35
30
 
36
 
    
37
31
    def test_add_and_gets(self):
38
 
        '''
39
 
        Test for the __init__, _get_by_first, _get_by_second function
40
 
        '''
 
32
        """ Test for the __init__, _get_by_first, _get_by_second function """
41
33
        pairs = [(uuid.uuid4(), uuid.uuid4()) for a in xrange(10)]
42
34
        bidict = BiDict(*pairs)
43
35
        for pair in pairs:
45
37
            self.assertEqual(bidict._get_by_second(pair[1]), pair[0])
46
38
 
47
39
    def test_remove_by_first_or_second(self):
48
 
        '''
49
 
        Tests for removing elements from the biDict
50
 
        '''
 
40
        """ Tests for removing elements from the biDict """
51
41
        pair_first = (1, 'one')
52
42
        pair_second = (2, 'two')
53
43
        bidict = BiDict(pair_first, pair_second)
74
64
        self.assertEqual(missing_first, 2)
75
65
        self.assertEqual(missing_second, 2)
76
66
 
 
67
 
77
68
def test_suite():
78
69
    return unittest.TestLoader().loadTestsFromTestCase(TestBiDict)
79