~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_xml.py

[merge] jam-integration 1495

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from cStringIO import StringIO
18
18
 
19
 
from bzrlib.selftest import TestCase
 
19
from bzrlib.tests import TestCase
20
20
from bzrlib.inventory import Inventory, InventoryEntry
21
21
from bzrlib.xml4 import serializer_v4
22
22
from bzrlib.xml5 import serializer_v5
126
126
        self.assertEqual(inv, inv2)
127
127
 
128
128
    def test_repack_revision_5(self):
 
129
        """Round-trip revision to XML v5"""
129
130
        inp = StringIO(_revision_v5)
130
131
        rev = serializer_v5.read_revision(inp)
131
132
        outp = StringIO()
132
133
        serializer_v5.write_revision(rev, outp)
133
 
        rev2 = serializer_v5.read_revision(StringIO(outp.getvalue()))
 
134
        outfile_contents = outp.getvalue()
 
135
        rev2 = serializer_v5.read_revision(StringIO(outfile_contents))
134
136
        self.assertEqual(rev, rev2)
135
137
 
 
138
    def test_pack_revision_5(self):
 
139
        """Pack revision to XML v5"""
 
140
        # fixed 20051025, revisions should have final newline
 
141
        rev = serializer_v5.read_revision_from_string(_revision_v5)
 
142
        outp = StringIO()
 
143
        serializer_v5.write_revision(rev, outp)
 
144
        outfile_contents = outp.getvalue()
 
145
        self.assertEqual(outfile_contents[-1], '\n')
 
146
        self.assertEqualDiff(outfile_contents, serializer_v5.write_revision_to_string(rev))