71
71
Each copy is also given a new id() to make it easy to identify.
75
# Permutation 1 of utf-8
76
('utf-8', {'committer':_erik
77
, 'message':_yellow_horse
78
, 'filename':_shrimp_sandwich
79
, 'directory':_nihonjin}),
80
# Permutation 2 of utf-8
81
('utf-8', {'committer':_alexander
82
, 'message':u'Testing ' + _mu
84
, 'directory':_juju_alt}),
85
('iso-8859-1', {'committer':_erik
86
, 'message':u'Testing ' + _mu
87
, 'filename':_juju_alt
88
, 'directory':_shrimp_sandwich}),
89
('iso-8859-2', {'committer':'TODO-iso8859-2-committer'
90
, 'message':_yellow_horse
91
, 'filename':'TODO-iso8859-2-filename'
92
, 'directory':'TODO-iso8859-2-dir'}),
93
('cp1251', {'committer':_alexander
94
, 'message':u'Testing ' + _mu
95
, 'filename':'TODO-cp1251-filename'
96
, 'directory':'TODO-cp1251-dir'}),
74
99
def adapt(self, test):
75
100
result = TestSuite()
76
for encoding, info in self._test_permutations():
101
for encoding, info in self._encodings:
77
102
new_test = deepcopy(test)
78
103
new_test.encoding = encoding
79
104
new_test.info = info
81
return '%s(%s)' % (new_test.id(), encoding)
82
new_test.id = new_test_id
105
def make_new_test_id():
106
new_id = "%s(%s)" % (new_test.id(), encoding)
107
return lambda: new_id
108
new_test.id = make_new_test_id()
83
109
result.addTest(new_test)
86
def _test_permutations(self):
87
"""Return a list of encoding/info pairs to test.
89
encoding should be a string such as 'utf-8'
90
info is a dictionary containing 'committer', 'filename', 'message',
94
# Permutation 1 of utf-8
95
('utf-8', {'committer':_erik
96
, 'message':_yellow_horse
97
, 'filename':_shrimp_sandwich
98
, 'directory':_nihonjin}),
99
# Permutation 2 of utf-8
100
('utf-8', {'committer':_alexander
101
, 'message':u'Testing ' + _mu
103
, 'directory':_juju_alt}),
104
('iso-8859-1', {'committer':_erik
105
, 'message':u'Testing ' + _mu
106
, 'filename':_juju_alt
107
, 'directory':_shrimp_sandwich}),
108
('iso-8859-2', {'committer':'TODO-iso8859-2-committer'
109
, 'message':_yellow_horse
110
, 'filename':'TODO-iso8859-2-filename'
111
, 'directory':'TODO-iso8859-2-dir'}),
112
('cp1251', {'committer':_alexander
113
, 'message':u'Testing ' + _mu
114
, 'filename':'TODO-cp1251-filename'
115
, 'directory':'TODO-cp1251-dir'}),