~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Martin
  • Date: 2011-05-21 16:29:38 UTC
  • mto: This revision was merged to the branch mainline in revision 5907.
  • Revision ID: gzlist@googlemail.com-20110521162938-1vrw3hp0197l3vrl
Add tests for non-ascii conflict serialisation

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
        self.assertEqual(conflicts.ConflictList([]), tree.conflicts())
126
126
 
127
127
 
128
 
class TestConflictStanzas(tests.TestCase):
 
128
class TestPerConflict(tests.TestCase):
129
129
 
130
130
    scenarios = scenarios.multiply_scenarios(vary_by_conflicts())
131
131
 
 
132
    def test_stringification(self):
 
133
        text = unicode(self.conflict)
 
134
        self.assertContainsString(text, self.conflict.path)
 
135
        self.assertContainsString(text.lower(), "conflict")
 
136
        self.assertContainsString(repr(self.conflict),
 
137
            self.conflict.__class__.__name__)
 
138
 
132
139
    def test_stanza_roundtrip(self):
133
140
        p = self.conflict
134
141
        o = conflicts.Conflict.factory(**p.as_stanza().as_dict())
159
166
            self.assertStartsWith(stanza['conflict_file_id'], u'\xeed')
160
167
 
161
168
 
162
 
class TestConflictListStanzas(tests.TestCase):
 
169
class TestConflictList(tests.TestCase):
163
170
 
164
171
    def test_stanzas_roundtrip(self):
165
172
        stanzas_iter = example_conflicts.to_stanzas()
166
173
        processed = conflicts.ConflictList.from_stanzas(stanzas_iter)
167
174
        self.assertEqual(example_conflicts, processed)
168
175
 
 
176
    def test_stringification(self):
 
177
        for text, o in zip(example_conflicts.to_strings(), example_conflicts):
 
178
            self.assertEqual(text, unicode(o))
 
179
 
169
180
 
170
181
# FIXME: The shell-like tests should be converted to real whitebox tests... or
171
182
# moved to a blackbox module -- vila 20100205