~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevprops.py

- constraints on revprops
- tests for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        """Simple revision properties"""
11
11
        b = Branch.initialize('.')
12
12
        props = dict(flavor='choc-mint', 
13
 
                     condiment='chilli')
 
13
                     condiment='orange\n  mint\n\tcandy')
14
14
        b.commit(message='initial null commit', 
15
15
                 revprops=props,
16
16
                 allow_pointless=True,
18
18
        rev = b.get_revision('test@user-1')
19
19
        self.assertTrue('flavor' in rev.properties)
20
20
        self.assertEquals(rev.properties['flavor'], 'choc-mint')
21
 
        self.assertEquals(rev.properties['condiment'], 'chilli')
22
21
        self.assertEquals(sorted(rev.properties.items()),
23
 
                          [('condiment', 'chilli'),
 
22
                          [('condiment', 'orange\n  mint\n\tcandy'),
24
23
                           ('flavor', 'choc-mint')])
25
24
 
26
 
        # TODO: try properties with newlines and indenting
27
 
 
28
 
        # TODO: property names with newlines are disallowed
29
 
 
30
 
        # TODO: Can't add non-string properties
31
 
 
32
 
        # TODO: Properties are retrieved correctly
33
 
 
 
25
    def test_invalid_revprops(self):
 
26
        """Invalid revision properties"""
 
27
        b = Branch.initialize('.')
 
28
        self.assertRaises(ValueError,
 
29
                          b.commit, 
 
30
                          message='invalid',
 
31
                          revprops={'what a silly property': 'fine'})
 
32
        self.assertRaises(ValueError,
 
33
                          b.commit, 
 
34
                          message='invalid',
 
35
                          revprops=dict(number=13))