/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Robert Collins
  • Date: 2007-03-07 01:14:11 UTC
  • mfrom: (2321 +trunk)
  • mto: (2321.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070307011411-0cmmc8atx67v3nv7
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
# The order of 'path' here is important - do not let it
34
34
# be a sorted list.
 
35
# u'\xe5' == a with circle
 
36
# '\xc3\xae' == u'\xee' == i with hat
 
37
# So these are u'pathg' and 'idg' only with a circle and a hat. (shappo?)
35
38
example_conflicts = ConflictList([ 
36
 
    MissingParent('Not deleting', 'pathg', 'idg'),
37
 
    ContentsConflict('patha', 'ida'), 
38
 
    TextConflict('patha'),
39
 
    PathConflict('pathb', 'pathc', 'idb'),
40
 
    DuplicateID('Unversioned existing file', 'pathc', 'pathc2', 'idc', 'idc'),
41
 
    DuplicateEntry('Moved existing file to',  'pathdd.moved', 'pathd', 'idd', 
42
 
                   None),
43
 
    ParentLoop('Cancelled move', 'pathe', 'path2e', None, 'id2e'),
44
 
    UnversionedParent('Versioned directory', 'pathf', 'idf'),
 
39
    MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
 
40
    ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'), 
 
41
    TextConflict(u'p\xe5tha'),
 
42
    PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
 
43
    DuplicateID('Unversioned existing file', u'p\xe5thc', u'p\xe5thc2',
 
44
                '\xc3\xaedc', '\xc3\xaedc'),
 
45
    DuplicateEntry('Moved existing file to',  u'p\xe5thdd.moved', u'p\xe5thd',
 
46
                   '\xc3\xaedd', None),
 
47
    ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
 
48
               None, '\xc3\xaed2e'),
 
49
    UnversionedParent('Versioned directory', u'p\xe5thf', '\xc3\xaedf'),
45
50
])
46
51
 
47
52
 
91
96
        # write and read our example stanza.
92
97
        stanza_iter = example_conflicts.to_stanzas()
93
98
        processed = ConflictList.from_stanzas(stanza_iter)
94
 
        for o,p in zip(processed, example_conflicts):
 
99
        for o, p in zip(processed, example_conflicts):
95
100
            self.assertEqual(o, p)
96
101
 
 
102
            self.assertIsInstance(o.path, unicode)
 
103
 
 
104
            if o.file_id is not None:
 
105
                self.assertIsInstance(o.file_id, str)
 
106
 
 
107
            conflict_path = getattr(o, 'conflict_path', None)
 
108
            if conflict_path is not None:
 
109
                self.assertIsInstance(conflict_path, unicode)
 
110
 
 
111
            conflict_file_id = getattr(o, 'conflict_file_id', None)
 
112
            if conflict_file_id is not None:
 
113
                self.assertIsInstance(conflict_file_id, str)
 
114
 
97
115
    def test_stanzification(self):
98
116
        for stanza in example_conflicts.to_stanzas():
99
 
            try:
100
 
                self.assertStartsWith(stanza['file_id'], 'id')
101
 
            except KeyError:
102
 
                pass
103
 
            self.assertStartsWith(stanza['path'], 'path')
104
 
            try:
105
 
                self.assertStartsWith(stanza['conflict_file_id'], 'id')
106
 
                self.assertStartsWith(stanza['conflict_file_path'], 'path')
107
 
            except KeyError:
108
 
                pass
 
117
            if 'file_id' in stanza:
 
118
                # In Stanza form, the file_id has to be unicode.
 
119
                self.assertStartsWith(stanza['file_id'], u'\xeed')
 
120
            self.assertStartsWith(stanza['path'], u'p\xe5th')
 
121
            if 'conflict_path' in stanza:
 
122
                self.assertStartsWith(stanza['conflict_path'], u'p\xe5th')
 
123
            if 'conflict_file_id' in stanza:
 
124
                self.assertStartsWith(stanza['conflict_file_id'], u'\xeed')