bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.1.55
by Martin Pool
doc |
1 |
#! /usr/bin/python2.4
|
2 |
||
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
3 |
# Copyright (C) 2005 by Canonical Ltd
|
4 |
||
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
9 |
||
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
14 |
||
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 |
||
19 |
||
20 |
||
21 |
||
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
22 |
"""test suite for weave algorithm"""
|
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
23 |
|
24 |
||
25 |
from testsweet import TestBase |
|
|
0.1.47
by Martin Pool
New WeaveError and WeaveFormatError rather than assertions. |
26 |
from weave import Weave, VerInfo, WeaveFormatError |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
27 |
|
|
0.1.52
by Martin Pool
Update tests for new weave representation |
28 |
# XXX: If we do weaves this way, will a merge still behave the same
|
29 |
# way if it's done in a different order? That's a pretty desirable
|
|
30 |
# property.
|
|
31 |
||
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
32 |
|
33 |
# texts for use in testing
|
|
|
0.1.3
by Martin Pool
Change storage of texts for testing |
34 |
TEXT_0 = ["Hello world"] |
35 |
TEXT_1 = ["Hello world", |
|
36 |
"A second line"] |
|
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
37 |
|
38 |
||
39 |
class Easy(TestBase): |
|
40 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
41 |
k = Weave() |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
42 |
|
43 |
||
44 |
class StoreText(TestBase): |
|
45 |
"""Store and retrieve a simple text.""" |
|
46 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
47 |
k = Weave() |
|
0.1.26
by Martin Pool
Refactor parameters to add command |
48 |
idx = k.add([], TEXT_0) |
|
0.1.4
by Martin Pool
Start indexing knits by both integer and version string. |
49 |
self.assertEqual(k.get(idx), TEXT_0) |
50 |
self.assertEqual(idx, 0) |
|
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
51 |
|
52 |
||
|
0.1.7
by Martin Pool
Add trivial annotate text |
53 |
|
54 |
class AnnotateOne(TestBase): |
|
55 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
56 |
k = Weave() |
|
0.1.26
by Martin Pool
Refactor parameters to add command |
57 |
k.add([], TEXT_0) |
|
0.1.7
by Martin Pool
Add trivial annotate text |
58 |
self.assertEqual(k.annotate(0), |
59 |
[(0, TEXT_0[0])]) |
|
60 |
||
61 |
||
|
0.1.5
by Martin Pool
Add test for storing two text versions. |
62 |
class StoreTwo(TestBase): |
63 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
64 |
k = Weave() |
|
0.1.5
by Martin Pool
Add test for storing two text versions. |
65 |
|
|
0.1.26
by Martin Pool
Refactor parameters to add command |
66 |
idx = k.add([], TEXT_0) |
|
0.1.5
by Martin Pool
Add test for storing two text versions. |
67 |
self.assertEqual(idx, 0) |
68 |
||
|
0.1.26
by Martin Pool
Refactor parameters to add command |
69 |
idx = k.add([], TEXT_1) |
|
0.1.5
by Martin Pool
Add test for storing two text versions. |
70 |
self.assertEqual(idx, 1) |
71 |
||
72 |
self.assertEqual(k.get(0), TEXT_0) |
|
73 |
self.assertEqual(k.get(1), TEXT_1) |
|
74 |
||
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
75 |
k.dump(self.TEST_LOG) |
76 |
||
77 |
||
|
0.1.21
by Martin Pool
Start computing a delta to insert a new revision |
78 |
|
|
0.1.55
by Martin Pool
doc |
79 |
class DeltaAdd(TestBase): |
|
0.1.21
by Martin Pool
Start computing a delta to insert a new revision |
80 |
"""Detection of changes prior to inserting new revision.""" |
81 |
def runTest(self): |
|
82 |
from pprint import pformat |
|
83 |
||
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
84 |
k = Weave() |
|
0.1.26
by Martin Pool
Refactor parameters to add command |
85 |
k.add([], ['line 1']) |
|
0.1.21
by Martin Pool
Start computing a delta to insert a new revision |
86 |
|
|
0.1.52
by Martin Pool
Update tests for new weave representation |
87 |
self.assertEqual(k._l, |
88 |
[('{', 0), |
|
89 |
'line 1', |
|
90 |
('}', 0), |
|
91 |
])
|
|
92 |
||
|
0.1.22
by Martin Pool
Calculate delta for new versions relative to a set of parent versions. |
93 |
changes = list(k._delta(set([0]), |
94 |
['line 1', |
|
95 |
'new line'])) |
|
|
0.1.21
by Martin Pool
Start computing a delta to insert a new revision |
96 |
|
97 |
self.log('raw changes: ' + pformat(changes)) |
|
98 |
||
|
0.1.52
by Martin Pool
Update tests for new weave representation |
99 |
# currently there are 3 lines in the weave, and we insert after them
|
|
0.1.22
by Martin Pool
Calculate delta for new versions relative to a set of parent versions. |
100 |
self.assertEquals(changes, |
|
0.1.52
by Martin Pool
Update tests for new weave representation |
101 |
[(3, 3, ['new line'])]) |
|
0.1.22
by Martin Pool
Calculate delta for new versions relative to a set of parent versions. |
102 |
|
|
0.1.24
by Martin Pool
Add another change for delta of new version. |
103 |
changes = k._delta(set([0]), |
104 |
['top line', |
|
105 |
'line 1']) |
|
106 |
||
107 |
self.assertEquals(list(changes), |
|
|
0.1.54
by Martin Pool
Fix weave line calculation when making deltas |
108 |
[(1, 1, ['top line'])]) |
|
0.1.24
by Martin Pool
Add another change for delta of new version. |
109 |
|
110 |
||
|
0.1.21
by Martin Pool
Start computing a delta to insert a new revision |
111 |
|
|
0.1.27
by Martin Pool
Check that version numbers passed in are reasonable |
112 |
class InvalidAdd(TestBase): |
113 |
"""Try to use invalid version number during add.""" |
|
114 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
115 |
k = Weave() |
|
0.1.27
by Martin Pool
Check that version numbers passed in are reasonable |
116 |
|
117 |
self.assertRaises(IndexError, |
|
118 |
k.add, |
|
119 |
[69], |
|
120 |
['new text!']) |
|
121 |
||
122 |
||
|
0.1.26
by Martin Pool
Refactor parameters to add command |
123 |
class InsertLines(TestBase): |
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
124 |
"""Store a revision that adds one line to the original. |
125 |
||
126 |
Look at the annotations to make sure that the first line is matched
|
|
127 |
and not stored repeatedly."""
|
|
128 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
129 |
k = Weave() |
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
130 |
|
|
0.1.26
by Martin Pool
Refactor parameters to add command |
131 |
k.add([], ['line 1']) |
132 |
k.add([0], ['line 1', 'line 2']) |
|
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
133 |
|
134 |
self.assertEqual(k.annotate(0), |
|
135 |
[(0, 'line 1')]) |
|
136 |
||
|
0.1.25
by Martin Pool
Handle insertion of new weave layers that insert text on top of the basis |
137 |
self.assertEqual(k.get(1), |
138 |
['line 1', |
|
139 |
'line 2']) |
|
140 |
||
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
141 |
self.assertEqual(k.annotate(1), |
142 |
[(0, 'line 1'), |
|
143 |
(1, 'line 2')]) |
|
144 |
||
|
0.1.28
by Martin Pool
More tests for insertion of lines in new versions. |
145 |
k.add([0], ['line 1', 'diverged line']) |
146 |
||
147 |
self.assertEqual(k.annotate(2), |
|
148 |
[(0, 'line 1'), |
|
149 |
(2, 'diverged line')]) |
|
150 |
||
|
0.1.54
by Martin Pool
Fix weave line calculation when making deltas |
151 |
text3 = ['line 1', 'middle line', 'line 2'] |
|
0.1.28
by Martin Pool
More tests for insertion of lines in new versions. |
152 |
k.add([0, 1], |
|
0.1.54
by Martin Pool
Fix weave line calculation when making deltas |
153 |
text3) |
154 |
||
155 |
from pprint import pformat |
|
156 |
||
157 |
self.log("changes to text3: " + pformat(list(k._delta(set([0, 1]), text3)))) |
|
158 |
||
159 |
self.log("k._l=" + pformat(k._l)) |
|
|
0.1.28
by Martin Pool
More tests for insertion of lines in new versions. |
160 |
|
161 |
self.assertEqual(k.annotate(3), |
|
162 |
[(0, 'line 1'), |
|
163 |
(3, 'middle line'), |
|
164 |
(1, 'line 2')]) |
|
165 |
||
|
0.1.31
by Martin Pool
Fix insertion of multiple regions, calculating the right line offset as we go. |
166 |
# now multiple insertions at different places
|
167 |
k.add([0, 1, 3], |
|
168 |
['line 1', 'aaa', 'middle line', 'bbb', 'line 2', 'ccc']) |
|
169 |
||
170 |
self.assertEqual(k.annotate(4), |
|
171 |
[(0, 'line 1'), |
|
172 |
(4, 'aaa'), |
|
173 |
(3, 'middle line'), |
|
174 |
(4, 'bbb'), |
|
175 |
(1, 'line 2'), |
|
176 |
(4, 'ccc')]) |
|
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
177 |
|
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
178 |
|
|
0.1.48
by Martin Pool
Basic parsing of delete instructions. |
179 |
|
|
0.1.49
by Martin Pool
Add another constraint: revisions should not delete text that they |
180 |
class SuicideDelete(TestBase): |
|
0.1.55
by Martin Pool
doc |
181 |
"""Invalid weave which tries to add and delete simultaneously.""" |
|
0.1.49
by Martin Pool
Add another constraint: revisions should not delete text that they |
182 |
def runTest(self): |
183 |
k = Weave() |
|
184 |
||
185 |
k._v = [VerInfo([]), |
|
186 |
]
|
|
187 |
k._l = [('{', 0), |
|
188 |
'first line', |
|
189 |
('[', 0), |
|
190 |
'deleted in 0', |
|
191 |
(']', 0), |
|
192 |
('}', 0), |
|
193 |
]
|
|
194 |
||
195 |
self.assertRaises(WeaveFormatError, |
|
196 |
k.get, |
|
197 |
0) |
|
198 |
||
199 |
||
200 |
||
|
0.1.48
by Martin Pool
Basic parsing of delete instructions. |
201 |
class CannedDelete(TestBase): |
202 |
"""Unpack canned weave with deleted lines.""" |
|
203 |
def runTest(self): |
|
204 |
k = Weave() |
|
205 |
||
206 |
k._v = [VerInfo([]), |
|
207 |
VerInfo([0]), |
|
208 |
]
|
|
209 |
k._l = [('{', 0), |
|
210 |
'first line', |
|
211 |
('[', 1), |
|
212 |
'line to be deleted', |
|
213 |
(']', 1), |
|
214 |
'last line', |
|
215 |
('}', 0), |
|
216 |
]
|
|
217 |
||
218 |
self.assertEqual(k.get(0), |
|
219 |
['first line', |
|
220 |
'line to be deleted', |
|
221 |
'last line', |
|
222 |
])
|
|
223 |
||
|
0.1.50
by Martin Pool
Basic implementation of deletion markers |
224 |
self.assertEqual(k.get(1), |
225 |
['first line', |
|
226 |
'last line', |
|
227 |
])
|
|
228 |
||
|
0.1.48
by Martin Pool
Basic parsing of delete instructions. |
229 |
|
230 |
||
|
0.1.51
by Martin Pool
Add test for replacement lines |
231 |
class CannedReplacement(TestBase): |
232 |
"""Unpack canned weave with deleted lines.""" |
|
233 |
def runTest(self): |
|
234 |
k = Weave() |
|
235 |
||
236 |
k._v = [VerInfo([]), |
|
237 |
VerInfo([0]), |
|
238 |
]
|
|
239 |
k._l = [('{', 0), |
|
240 |
'first line', |
|
241 |
('[', 1), |
|
242 |
'line to be deleted', |
|
243 |
(']', 1), |
|
244 |
('{', 1), |
|
245 |
'replacement line', |
|
246 |
('}', 1), |
|
247 |
'last line', |
|
248 |
('}', 0), |
|
249 |
]
|
|
250 |
||
251 |
self.assertEqual(k.get(0), |
|
252 |
['first line', |
|
253 |
'line to be deleted', |
|
254 |
'last line', |
|
255 |
])
|
|
256 |
||
257 |
self.assertEqual(k.get(1), |
|
258 |
['first line', |
|
259 |
'replacement line', |
|
260 |
'last line', |
|
261 |
])
|
|
262 |
||
263 |
||
264 |
||
|
0.1.46
by Martin Pool
More constraints on structure of weave, and checks that they work |
265 |
class BadWeave(TestBase): |
266 |
"""Test that we trap an insert which should not occur.""" |
|
267 |
def runTest(self): |
|
268 |
k = Weave() |
|
269 |
||
270 |
k._v = [VerInfo([]), |
|
271 |
]
|
|
272 |
k._l = ['bad line', |
|
273 |
('{', 0), |
|
274 |
'foo {', |
|
275 |
('{', 1), |
|
276 |
' added in version 1', |
|
277 |
('{', 2), |
|
278 |
' added in v2', |
|
279 |
('}', 2), |
|
280 |
' also from v1', |
|
281 |
('}', 1), |
|
282 |
'}', |
|
283 |
('}', 0)] |
|
284 |
||
|
0.1.47
by Martin Pool
New WeaveError and WeaveFormatError rather than assertions. |
285 |
self.assertRaises(WeaveFormatError, |
|
0.1.46
by Martin Pool
More constraints on structure of weave, and checks that they work |
286 |
k.get, |
287 |
0) |
|
288 |
||
289 |
||
290 |
class BadInsert(TestBase): |
|
291 |
"""Test that we trap an insert which should not occur.""" |
|
292 |
def runTest(self): |
|
293 |
k = Weave() |
|
294 |
||
295 |
k._v = [VerInfo([]), |
|
296 |
VerInfo([0]), |
|
297 |
VerInfo([0]), |
|
298 |
VerInfo([0,1,2]), |
|
299 |
]
|
|
300 |
k._l = [('{', 0), |
|
301 |
'foo {', |
|
302 |
('{', 1), |
|
303 |
' added in version 1', |
|
304 |
('{', 1), |
|
305 |
' more in 1', |
|
306 |
('}', 1), |
|
307 |
('}', 1), |
|
308 |
('}', 0)] |
|
309 |
||
|
0.1.47
by Martin Pool
New WeaveError and WeaveFormatError rather than assertions. |
310 |
self.assertRaises(WeaveFormatError, |
|
0.1.46
by Martin Pool
More constraints on structure of weave, and checks that they work |
311 |
k.get, |
312 |
0) |
|
313 |
||
|
0.1.47
by Martin Pool
New WeaveError and WeaveFormatError rather than assertions. |
314 |
self.assertRaises(WeaveFormatError, |
|
0.1.46
by Martin Pool
More constraints on structure of weave, and checks that they work |
315 |
k.get, |
316 |
1) |
|
317 |
||
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
318 |
|
319 |
class InsertNested(TestBase): |
|
320 |
"""Insertion with nested instructions.""" |
|
321 |
def runTest(self): |
|
322 |
k = Weave() |
|
323 |
||
324 |
k._v = [VerInfo([]), |
|
325 |
VerInfo([0]), |
|
326 |
VerInfo([0]), |
|
|
0.1.44
by Martin Pool
More tests for nested insert instructions |
327 |
VerInfo([0,1,2]), |
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
328 |
]
|
329 |
k._l = [('{', 0), |
|
330 |
'foo {', |
|
331 |
('{', 1), |
|
332 |
' added in version 1', |
|
|
0.1.42
by Martin Pool
More tests for nested insert instructions |
333 |
('{', 2), |
334 |
' added in v2', |
|
335 |
('}', 2), |
|
336 |
' also from v1', |
|
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
337 |
('}', 1), |
338 |
'}', |
|
339 |
('}', 0)] |
|
340 |
||
341 |
self.assertEqual(k.get(0), |
|
342 |
['foo {', |
|
343 |
'}']) |
|
344 |
||
345 |
self.assertEqual(k.get(1), |
|
346 |
['foo {', |
|
347 |
' added in version 1', |
|
|
0.1.42
by Martin Pool
More tests for nested insert instructions |
348 |
' also from v1', |
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
349 |
'}']) |
350 |
||
|
0.1.44
by Martin Pool
More tests for nested insert instructions |
351 |
self.assertEqual(k.get(2), |
352 |
['foo {', |
|
353 |
' added in v2', |
|
354 |
'}']) |
|
355 |
||
356 |
self.assertEqual(k.get(3), |
|
357 |
['foo {', |
|
358 |
' added in version 1', |
|
359 |
' added in v2', |
|
360 |
' also from v1', |
|
361 |
'}']) |
|
362 |
||
|
0.1.45
by Martin Pool
doc |
363 |
|
|
0.1.40
by Martin Pool
Add test for extracting from weave with nested insertions |
364 |
|
|
0.1.30
by Martin Pool
Start adding tests for line deletion |
365 |
class DeleteLines(TestBase): |
366 |
"""Test recording revisions that delete lines. |
|
367 |
||
368 |
This relies on the weave having a way to represent lines knocked
|
|
369 |
out by a later revision."""
|
|
370 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
371 |
k = Weave() |
|
0.1.30
by Martin Pool
Start adding tests for line deletion |
372 |
|
373 |
k.add([], ["line the first", |
|
374 |
"line 2", |
|
375 |
"line 3", |
|
376 |
"fine"]) |
|
377 |
||
378 |
self.assertEqual(len(k.get(0)), 4) |
|
379 |
||
380 |
return ################################## SKIPPED |
|
381 |
||
382 |
k.add([0], ["line the first", |
|
383 |
"fine"]) |
|
384 |
||
385 |
self.assertEqual(k.get(1), |
|
386 |
["line the first", |
|
387 |
"fine"]) |
|
388 |
||
389 |
||
|
0.1.26
by Martin Pool
Refactor parameters to add command |
390 |
|
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
391 |
class IncludeVersions(TestBase): |
392 |
"""Check texts that are stored across multiple revisions. |
|
393 |
||
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
394 |
Here we manually create a weave with particular encoding and make
|
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
395 |
sure it unpacks properly.
|
396 |
||
397 |
Text 0 includes nothing; text 1 includes text 0 and adds some
|
|
398 |
lines.
|
|
399 |
"""
|
|
400 |
||
401 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
402 |
k = Weave() |
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
403 |
|
|
0.1.17
by Martin Pool
Use objects rather than tuples for tracking VerInfo for |
404 |
k._v = [VerInfo(), VerInfo(included=[0])] |
|
0.1.39
by Martin Pool
Change to a more realistic weave structure which can represent insertions and |
405 |
k._l = [('{', 0), |
406 |
"first line", |
|
407 |
('}', 0), |
|
408 |
('{', 1), |
|
409 |
"second line", |
|
410 |
('}', 1)] |
|
|
0.1.13
by Martin Pool
Knit structure now allows for versions to include the lines present in other |
411 |
|
412 |
self.assertEqual(k.get(1), |
|
413 |
["first line", |
|
414 |
"second line"]) |
|
415 |
||
416 |
self.assertEqual(k.get(0), |
|
417 |
["first line"]) |
|
418 |
||
419 |
k.dump(self.TEST_LOG) |
|
420 |
||
|
0.1.5
by Martin Pool
Add test for storing two text versions. |
421 |
|
|
0.1.14
by Martin Pool
Another test for version inclusion |
422 |
class DivergedIncludes(TestBase): |
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
423 |
"""Weave with two diverged texts based on version 0. |
|
0.1.14
by Martin Pool
Another test for version inclusion |
424 |
"""
|
425 |
def runTest(self): |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
426 |
k = Weave() |
|
0.1.14
by Martin Pool
Another test for version inclusion |
427 |
|
|
0.1.17
by Martin Pool
Use objects rather than tuples for tracking VerInfo for |
428 |
k._v = [VerInfo(), |
429 |
VerInfo(included=[0]), |
|
430 |
VerInfo(included=[0]), |
|
431 |
]
|
|
|
0.1.39
by Martin Pool
Change to a more realistic weave structure which can represent insertions and |
432 |
k._l = [('{', 0), |
433 |
"first line", |
|
434 |
('}', 0), |
|
435 |
('{', 1), |
|
436 |
"second line", |
|
437 |
('}', 1), |
|
438 |
('{', 2), |
|
439 |
"alternative second line", |
|
440 |
('}', 2), |
|
441 |
]
|
|
|
0.1.14
by Martin Pool
Another test for version inclusion |
442 |
|
443 |
self.assertEqual(k.get(0), |
|
444 |
["first line"]) |
|
445 |
||
446 |
self.assertEqual(k.get(1), |
|
447 |
["first line", |
|
448 |
"second line"]) |
|
449 |
||
450 |
self.assertEqual(k.get(2), |
|
451 |
["first line", |
|
452 |
"alternative second line"]) |
|
453 |
||
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
454 |
def testweave(): |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
455 |
import testsweet |
456 |
from unittest import TestSuite, TestLoader |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
457 |
import testweave |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
458 |
|
459 |
tl = TestLoader() |
|
460 |
suite = TestSuite() |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
461 |
suite.addTest(tl.loadTestsFromModule(testweave)) |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
462 |
|
|
0.1.15
by Martin Pool
Fix inverted shell return code for testknit |
463 |
return int(not testsweet.run_suite(suite)) # for shell 0=true |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
464 |
|
465 |
||
466 |
if __name__ == '__main__': |
|
467 |
import sys |
|
|
0.1.38
by Martin Pool
Rename knit to weave. (I don't think there's an existing module called weave.) |
468 |
sys.exit(testweave()) |
|
0.1.2
by Martin Pool
Import testsweet module adapted from bzr. |
469 |