~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_xml.py

remove all trailing whitespace from bzr source

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from cStringIO import StringIO
18
18
 
19
19
from bzrlib import (
20
 
    errors, 
21
 
    inventory, 
 
20
    errors,
 
21
    inventory,
22
22
    xml7,
23
23
    xml8,
24
24
    xml_serializer,
80
80
"""
81
81
 
82
82
_committed_inv_v5 = """<inventory>
83
 
<file file_id="bar-20050901064931-73b4b1138abc9cd2" 
84
 
      name="bar" parent_id="TREE_ROOT" 
 
83
<file file_id="bar-20050901064931-73b4b1138abc9cd2"
 
84
      name="bar" parent_id="TREE_ROOT"
85
85
      revision="mbp@foo-123123"
86
86
      text_sha1="A" text_size="1"/>
87
87
<directory name="subdir"
88
88
           file_id="foo-20050801201819-4139aa4a272f4250"
89
 
           parent_id="TREE_ROOT" 
 
89
           parent_id="TREE_ROOT"
90
90
           revision="mbp@foo-00"/>
91
 
<file executable="yes" file_id="bar-20050824000535-6bc48cfad47ed134" 
92
 
      name="bar" parent_id="foo-20050801201819-4139aa4a272f4250" 
 
91
<file executable="yes" file_id="bar-20050824000535-6bc48cfad47ed134"
 
92
      name="bar" parent_id="foo-20050801201819-4139aa4a272f4250"
93
93
      revision="mbp@foo-00"
94
94
      text_sha1="B" text_size="0"/>
95
95
</inventory>
96
96
"""
97
97
 
98
98
_basis_inv_v5 = """<inventory revision_id="mbp@sourcefrog.net-20050905063503-43948f59fa127d92">
99
 
<file file_id="bar-20050901064931-73b4b1138abc9cd2" 
100
 
      name="bar" parent_id="TREE_ROOT" 
 
99
<file file_id="bar-20050901064931-73b4b1138abc9cd2"
 
100
      name="bar" parent_id="TREE_ROOT"
101
101
      revision="mbp@foo-123123"/>
102
102
<directory name="subdir"
103
103
           file_id="foo-20050801201819-4139aa4a272f4250"
104
 
           parent_id="TREE_ROOT" 
 
104
           parent_id="TREE_ROOT"
105
105
           revision="mbp@foo-00"/>
106
 
<file file_id="bar-20050824000535-6bc48cfad47ed134" 
107
 
      name="bar" parent_id="foo-20050801201819-4139aa4a272f4250" 
 
106
<file file_id="bar-20050824000535-6bc48cfad47ed134"
 
107
      name="bar" parent_id="foo-20050801201819-4139aa4a272f4250"
108
108
      revision="mbp@foo-00"/>
109
109
</inventory>
110
110
"""
294
294
        self.assertEqualDiff(_expected_inv_v5, outp.getvalue())
295
295
        inv2 = bzrlib.xml5.serializer_v5.read_inventory(StringIO(outp.getvalue()))
296
296
        self.assertEqual(inv, inv2)
297
 
    
 
297
 
298
298
    def assertRoundTrips(self, xml_string):
299
299
        inp = StringIO(xml_string)
300
300
        inv = bzrlib.xml5.serializer_v5.read_inventory(inp)
352
352
    def get_sample_inventory(self):
353
353
        inv = Inventory('tree-root-321', revision_id='rev_outer')
354
354
        inv.add(inventory.InventoryFile('file-id', 'file', 'tree-root-321'))
355
 
        inv.add(inventory.InventoryDirectory('dir-id', 'dir', 
 
355
        inv.add(inventory.InventoryDirectory('dir-id', 'dir',
356
356
                                             'tree-root-321'))
357
357
        inv.add(inventory.InventoryLink('link-id', 'link', 'tree-root-321'))
358
358
        inv['tree-root-321'].revision = 'rev_outer'
381
381
        """Can't accidentally open a file with wrong serializer"""
382
382
        s_v6 = bzrlib.xml6.serializer_v6
383
383
        s_v7 = xml7.serializer_v7
384
 
        self.assertRaises(errors.UnexpectedInventoryFormat, 
 
384
        self.assertRaises(errors.UnexpectedInventoryFormat,
385
385
                          s_v7.read_inventory_from_string, _expected_inv_v5)
386
 
        self.assertRaises(errors.UnexpectedInventoryFormat, 
 
386
        self.assertRaises(errors.UnexpectedInventoryFormat,
387
387
                          s_v6.read_inventory_from_string, _expected_inv_v7)
388
388
 
389
389
    def test_tree_reference(self):
405
405
        self.assertEqual('tree-root-321', inv2['nested-id'].parent_id)
406
406
        self.assertEqual('rev-outer', inv2['nested-id'].revision)
407
407
        self.assertEqual('rev-inner', inv2['nested-id'].reference_revision)
408
 
        self.assertRaises(errors.UnsupportedInventoryKind, 
 
408
        self.assertRaises(errors.UnsupportedInventoryKind,
409
409
                          s_v6.read_inventory_from_string,
410
410
                          txt.replace('format="7"', 'format="6"'))
411
 
        self.assertRaises(errors.UnsupportedInventoryKind, 
 
411
        self.assertRaises(errors.UnsupportedInventoryKind,
412
412
                          s_v5.read_inventory_from_string,
413
413
                          txt.replace('format="7"', 'format="5"'))
414
414