Show More
@@ -1,468 +1,469 | |||
|
1 | 1 | test-abort-checkin.t |
|
2 | 2 | test-add.t |
|
3 | 3 | test-addremove-similar.t |
|
4 | 4 | test-addremove.t |
|
5 | 5 | test-amend-subrepo.t |
|
6 | 6 | test-amend.t |
|
7 | 7 | test-ancestor.py |
|
8 | 8 | test-annotate.py |
|
9 | 9 | test-annotate.t |
|
10 | 10 | test-archive-symlinks.t |
|
11 | 11 | test-atomictempfile.py |
|
12 | 12 | test-audit-path.t |
|
13 | 13 | test-audit-subrepo.t |
|
14 | 14 | test-automv.t |
|
15 | 15 | test-backout.t |
|
16 | 16 | test-backwards-remove.t |
|
17 | 17 | test-basic.t |
|
18 | 18 | test-bheads.t |
|
19 | 19 | test-bisect.t |
|
20 | 20 | test-bisect2.t |
|
21 | 21 | test-bisect3.t |
|
22 | 22 | test-blackbox.t |
|
23 | 23 | test-bookmarks-current.t |
|
24 | 24 | test-bookmarks-merge.t |
|
25 | 25 | test-bookmarks-rebase.t |
|
26 | 26 | test-bookmarks-strip.t |
|
27 | 27 | test-bookmarks.t |
|
28 | 28 | test-branch-change.t |
|
29 | 29 | test-branch-option.t |
|
30 | 30 | test-branch-tag-confict.t |
|
31 | 31 | test-branches.t |
|
32 | 32 | test-bundle-phases.t |
|
33 | 33 | test-bundle-type.t |
|
34 | 34 | test-bundle-vs-outgoing.t |
|
35 | 35 | test-bundle2-multiple-changegroups.t |
|
36 | 36 | test-cappedreader.py |
|
37 | 37 | test-casecollision.t |
|
38 | 38 | test-cat.t |
|
39 | test-cbor.py | |
|
39 | 40 | test-censor.t |
|
40 | 41 | test-changelog-exec.t |
|
41 | 42 | test-check-commit.t |
|
42 | 43 | test-check-execute.t |
|
43 | 44 | test-check-interfaces.py |
|
44 | 45 | test-check-module-imports.t |
|
45 | 46 | test-check-pyflakes.t |
|
46 | 47 | test-check-pylint.t |
|
47 | 48 | test-check-shbang.t |
|
48 | 49 | test-children.t |
|
49 | 50 | test-clone-cgi.t |
|
50 | 51 | test-clone-pull-corruption.t |
|
51 | 52 | test-clone-r.t |
|
52 | 53 | test-clone-update-order.t |
|
53 | 54 | test-command-template.t |
|
54 | 55 | test-commit-amend.t |
|
55 | 56 | test-commit-interactive.t |
|
56 | 57 | test-commit-multiple.t |
|
57 | 58 | test-commit-unresolved.t |
|
58 | 59 | test-commit.t |
|
59 | 60 | test-committer.t |
|
60 | 61 | test-completion.t |
|
61 | 62 | test-config-env.py |
|
62 | 63 | test-config.t |
|
63 | 64 | test-conflict.t |
|
64 | 65 | test-confused-revert.t |
|
65 | 66 | test-contrib-check-code.t |
|
66 | 67 | test-contrib-check-commit.t |
|
67 | 68 | test-convert-authormap.t |
|
68 | 69 | test-convert-clonebranches.t |
|
69 | 70 | test-convert-datesort.t |
|
70 | 71 | test-convert-filemap.t |
|
71 | 72 | test-convert-hg-sink.t |
|
72 | 73 | test-convert-hg-source.t |
|
73 | 74 | test-convert-hg-startrev.t |
|
74 | 75 | test-convert-splicemap.t |
|
75 | 76 | test-convert-tagsbranch-topology.t |
|
76 | 77 | test-copy-move-merge.t |
|
77 | 78 | test-copy.t |
|
78 | 79 | test-copytrace-heuristics.t |
|
79 | 80 | test-debugbuilddag.t |
|
80 | 81 | test-debugbundle.t |
|
81 | 82 | test-debugextensions.t |
|
82 | 83 | test-debugindexdot.t |
|
83 | 84 | test-debugrename.t |
|
84 | 85 | test-default-push.t |
|
85 | 86 | test-diff-binary-file.t |
|
86 | 87 | test-diff-change.t |
|
87 | 88 | test-diff-copy-depth.t |
|
88 | 89 | test-diff-hashes.t |
|
89 | 90 | test-diff-ignore-whitespace.t |
|
90 | 91 | test-diff-indent-heuristic.t |
|
91 | 92 | test-diff-issue2761.t |
|
92 | 93 | test-diff-newlines.t |
|
93 | 94 | test-diff-reverse.t |
|
94 | 95 | test-diff-subdir.t |
|
95 | 96 | test-diff-unified.t |
|
96 | 97 | test-diff-upgrade.t |
|
97 | 98 | test-diffdir.t |
|
98 | 99 | test-diffstat.t |
|
99 | 100 | test-directaccess.t |
|
100 | 101 | test-dirstate-backup.t |
|
101 | 102 | test-dirstate-nonnormalset.t |
|
102 | 103 | test-dirstate.t |
|
103 | 104 | test-doctest.py |
|
104 | 105 | test-double-merge.t |
|
105 | 106 | test-drawdag.t |
|
106 | 107 | test-duplicateoptions.py |
|
107 | 108 | test-editor-filename.t |
|
108 | 109 | test-empty-dir.t |
|
109 | 110 | test-empty-file.t |
|
110 | 111 | test-empty-group.t |
|
111 | 112 | test-empty.t |
|
112 | 113 | test-encode.t |
|
113 | 114 | test-encoding-func.py |
|
114 | 115 | test-encoding.t |
|
115 | 116 | test-eol-add.t |
|
116 | 117 | test-eol-clone.t |
|
117 | 118 | test-eol-hook.t |
|
118 | 119 | test-eol-tag.t |
|
119 | 120 | test-eol-update.t |
|
120 | 121 | test-excessive-merge.t |
|
121 | 122 | test-exchange-obsmarkers-case-A1.t |
|
122 | 123 | test-exchange-obsmarkers-case-A2.t |
|
123 | 124 | test-exchange-obsmarkers-case-A3.t |
|
124 | 125 | test-exchange-obsmarkers-case-A4.t |
|
125 | 126 | test-exchange-obsmarkers-case-A5.t |
|
126 | 127 | test-exchange-obsmarkers-case-A6.t |
|
127 | 128 | test-exchange-obsmarkers-case-A7.t |
|
128 | 129 | test-exchange-obsmarkers-case-B1.t |
|
129 | 130 | test-exchange-obsmarkers-case-B2.t |
|
130 | 131 | test-exchange-obsmarkers-case-B3.t |
|
131 | 132 | test-exchange-obsmarkers-case-B4.t |
|
132 | 133 | test-exchange-obsmarkers-case-B5.t |
|
133 | 134 | test-exchange-obsmarkers-case-B6.t |
|
134 | 135 | test-exchange-obsmarkers-case-B7.t |
|
135 | 136 | test-exchange-obsmarkers-case-C1.t |
|
136 | 137 | test-exchange-obsmarkers-case-C2.t |
|
137 | 138 | test-exchange-obsmarkers-case-C3.t |
|
138 | 139 | test-exchange-obsmarkers-case-C4.t |
|
139 | 140 | test-exchange-obsmarkers-case-D1.t |
|
140 | 141 | test-exchange-obsmarkers-case-D2.t |
|
141 | 142 | test-exchange-obsmarkers-case-D3.t |
|
142 | 143 | test-exchange-obsmarkers-case-D4.t |
|
143 | 144 | test-execute-bit.t |
|
144 | 145 | test-export.t |
|
145 | 146 | test-extdata.t |
|
146 | 147 | test-extdiff.t |
|
147 | 148 | test-extra-filelog-entry.t |
|
148 | 149 | test-filebranch.t |
|
149 | 150 | test-fileset-generated.t |
|
150 | 151 | test-fix-topology.t |
|
151 | 152 | test-flags.t |
|
152 | 153 | test-generaldelta.t |
|
153 | 154 | test-getbundle.t |
|
154 | 155 | test-git-export.t |
|
155 | 156 | test-glog-topological.t |
|
156 | 157 | test-gpg.t |
|
157 | 158 | test-graft.t |
|
158 | 159 | test-hg-parseurl.py |
|
159 | 160 | test-hghave.t |
|
160 | 161 | test-hgignore.t |
|
161 | 162 | test-hgk.t |
|
162 | 163 | test-hgweb-bundle.t |
|
163 | 164 | test-hgweb-descend-empties.t |
|
164 | 165 | test-hgweb-empty.t |
|
165 | 166 | test-hgweb-removed.t |
|
166 | 167 | test-hgwebdir-paths.py |
|
167 | 168 | test-hgwebdirsym.t |
|
168 | 169 | test-histedit-arguments.t |
|
169 | 170 | test-histedit-base.t |
|
170 | 171 | test-histedit-bookmark-motion.t |
|
171 | 172 | test-histedit-commute.t |
|
172 | 173 | test-histedit-drop.t |
|
173 | 174 | test-histedit-edit.t |
|
174 | 175 | test-histedit-fold-non-commute.t |
|
175 | 176 | test-histedit-fold.t |
|
176 | 177 | test-histedit-no-change.t |
|
177 | 178 | test-histedit-non-commute-abort.t |
|
178 | 179 | test-histedit-non-commute.t |
|
179 | 180 | test-histedit-obsolete.t |
|
180 | 181 | test-histedit-outgoing.t |
|
181 | 182 | test-histedit-templates.t |
|
182 | 183 | test-http-branchmap.t |
|
183 | 184 | test-http-bundle1.t |
|
184 | 185 | test-http-clone-r.t |
|
185 | 186 | test-http.t |
|
186 | 187 | test-hybridencode.py |
|
187 | 188 | test-identify.t |
|
188 | 189 | test-import-unknown.t |
|
189 | 190 | test-import.t |
|
190 | 191 | test-imports-checker.t |
|
191 | 192 | test-incoming-outgoing.t |
|
192 | 193 | test-inherit-mode.t |
|
193 | 194 | test-issue1089.t |
|
194 | 195 | test-issue1102.t |
|
195 | 196 | test-issue1175.t |
|
196 | 197 | test-issue1306.t |
|
197 | 198 | test-issue1438.t |
|
198 | 199 | test-issue1502.t |
|
199 | 200 | test-issue1802.t |
|
200 | 201 | test-issue1877.t |
|
201 | 202 | test-issue1993.t |
|
202 | 203 | test-issue2137.t |
|
203 | 204 | test-issue3084.t |
|
204 | 205 | test-issue4074.t |
|
205 | 206 | test-issue522.t |
|
206 | 207 | test-issue586.t |
|
207 | 208 | test-issue612.t |
|
208 | 209 | test-issue619.t |
|
209 | 210 | test-issue660.t |
|
210 | 211 | test-issue672.t |
|
211 | 212 | test-issue842.t |
|
212 | 213 | test-journal-exists.t |
|
213 | 214 | test-journal-share.t |
|
214 | 215 | test-journal.t |
|
215 | 216 | test-largefiles-cache.t |
|
216 | 217 | test-largefiles-misc.t |
|
217 | 218 | test-largefiles-small-disk.t |
|
218 | 219 | test-largefiles-update.t |
|
219 | 220 | test-largefiles.t |
|
220 | 221 | test-lfs-largefiles.t |
|
221 | 222 | test-linerange.py |
|
222 | 223 | test-locate.t |
|
223 | 224 | test-lock-badness.t |
|
224 | 225 | test-log-linerange.t |
|
225 | 226 | test-log.t |
|
226 | 227 | test-logexchange.t |
|
227 | 228 | test-lrucachedict.py |
|
228 | 229 | test-mactext.t |
|
229 | 230 | test-mailmap.t |
|
230 | 231 | test-manifest-merging.t |
|
231 | 232 | test-manifest.py |
|
232 | 233 | test-manifest.t |
|
233 | 234 | test-match.py |
|
234 | 235 | test-mdiff.py |
|
235 | 236 | test-merge-changedelete.t |
|
236 | 237 | test-merge-closedheads.t |
|
237 | 238 | test-merge-commit.t |
|
238 | 239 | test-merge-criss-cross.t |
|
239 | 240 | test-merge-default.t |
|
240 | 241 | test-merge-force.t |
|
241 | 242 | test-merge-halt.t |
|
242 | 243 | test-merge-internal-tools-pattern.t |
|
243 | 244 | test-merge-local.t |
|
244 | 245 | test-merge-remove.t |
|
245 | 246 | test-merge-revert.t |
|
246 | 247 | test-merge-revert2.t |
|
247 | 248 | test-merge-subrepos.t |
|
248 | 249 | test-merge-symlinks.t |
|
249 | 250 | test-merge-tools.t |
|
250 | 251 | test-merge-types.t |
|
251 | 252 | test-merge1.t |
|
252 | 253 | test-merge10.t |
|
253 | 254 | test-merge2.t |
|
254 | 255 | test-merge4.t |
|
255 | 256 | test-merge5.t |
|
256 | 257 | test-merge6.t |
|
257 | 258 | test-merge7.t |
|
258 | 259 | test-merge8.t |
|
259 | 260 | test-merge9.t |
|
260 | 261 | test-minifileset.py |
|
261 | 262 | test-minirst.py |
|
262 | 263 | test-mq-git.t |
|
263 | 264 | test-mq-header-date.t |
|
264 | 265 | test-mq-header-from.t |
|
265 | 266 | test-mq-merge.t |
|
266 | 267 | test-mq-pull-from-bundle.t |
|
267 | 268 | test-mq-qclone-http.t |
|
268 | 269 | test-mq-qdelete.t |
|
269 | 270 | test-mq-qdiff.t |
|
270 | 271 | test-mq-qfold.t |
|
271 | 272 | test-mq-qgoto.t |
|
272 | 273 | test-mq-qimport-fail-cleanup.t |
|
273 | 274 | test-mq-qnew.t |
|
274 | 275 | test-mq-qpush-exact.t |
|
275 | 276 | test-mq-qqueue.t |
|
276 | 277 | test-mq-qrefresh-interactive.t |
|
277 | 278 | test-mq-qrefresh-replace-log-message.t |
|
278 | 279 | test-mq-qrefresh.t |
|
279 | 280 | test-mq-qrename.t |
|
280 | 281 | test-mq-qsave.t |
|
281 | 282 | test-mq-safety.t |
|
282 | 283 | test-mq-subrepo.t |
|
283 | 284 | test-mq-symlinks.t |
|
284 | 285 | test-mv-cp-st-diff.t |
|
285 | 286 | test-narrow-archive.t |
|
286 | 287 | test-narrow-clone-no-ellipsis.t |
|
287 | 288 | test-narrow-clone-non-narrow-server.t |
|
288 | 289 | test-narrow-clone-nonlinear.t |
|
289 | 290 | test-narrow-clone.t |
|
290 | 291 | test-narrow-commit.t |
|
291 | 292 | test-narrow-copies.t |
|
292 | 293 | test-narrow-debugcommands.t |
|
293 | 294 | test-narrow-debugrebuilddirstate.t |
|
294 | 295 | test-narrow-exchange-merges.t |
|
295 | 296 | test-narrow-exchange.t |
|
296 | 297 | test-narrow-expanddirstate.t |
|
297 | 298 | test-narrow-merge.t |
|
298 | 299 | test-narrow-patch.t |
|
299 | 300 | test-narrow-patterns.t |
|
300 | 301 | test-narrow-pull.t |
|
301 | 302 | test-narrow-rebase.t |
|
302 | 303 | test-narrow-shallow-merges.t |
|
303 | 304 | test-narrow-shallow.t |
|
304 | 305 | test-narrow-strip.t |
|
305 | 306 | test-narrow-update.t |
|
306 | 307 | test-nested-repo.t |
|
307 | 308 | test-newbranch.t |
|
308 | 309 | test-obshistory.t |
|
309 | 310 | test-obsmarker-template.t |
|
310 | 311 | test-obsmarkers-effectflag.t |
|
311 | 312 | test-obsolete-bundle-strip.t |
|
312 | 313 | test-obsolete-changeset-exchange.t |
|
313 | 314 | test-obsolete-checkheads.t |
|
314 | 315 | test-obsolete-distributed.t |
|
315 | 316 | test-obsolete-tag-cache.t |
|
316 | 317 | test-parents.t |
|
317 | 318 | test-parseindex2.py |
|
318 | 319 | test-pathconflicts-merge.t |
|
319 | 320 | test-pathconflicts-update.t |
|
320 | 321 | test-pathencode.py |
|
321 | 322 | test-pending.t |
|
322 | 323 | test-permissions.t |
|
323 | 324 | test-phases.t |
|
324 | 325 | test-pull-branch.t |
|
325 | 326 | test-pull-http.t |
|
326 | 327 | test-pull-permission.t |
|
327 | 328 | test-pull-pull-corruption.t |
|
328 | 329 | test-pull-r.t |
|
329 | 330 | test-pull-update.t |
|
330 | 331 | test-purge.t |
|
331 | 332 | test-push-checkheads-partial-C1.t |
|
332 | 333 | test-push-checkheads-partial-C2.t |
|
333 | 334 | test-push-checkheads-partial-C3.t |
|
334 | 335 | test-push-checkheads-partial-C4.t |
|
335 | 336 | test-push-checkheads-pruned-B1.t |
|
336 | 337 | test-push-checkheads-pruned-B2.t |
|
337 | 338 | test-push-checkheads-pruned-B3.t |
|
338 | 339 | test-push-checkheads-pruned-B4.t |
|
339 | 340 | test-push-checkheads-pruned-B5.t |
|
340 | 341 | test-push-checkheads-pruned-B6.t |
|
341 | 342 | test-push-checkheads-pruned-B7.t |
|
342 | 343 | test-push-checkheads-pruned-B8.t |
|
343 | 344 | test-push-checkheads-superceed-A1.t |
|
344 | 345 | test-push-checkheads-superceed-A2.t |
|
345 | 346 | test-push-checkheads-superceed-A3.t |
|
346 | 347 | test-push-checkheads-superceed-A4.t |
|
347 | 348 | test-push-checkheads-superceed-A5.t |
|
348 | 349 | test-push-checkheads-superceed-A6.t |
|
349 | 350 | test-push-checkheads-superceed-A7.t |
|
350 | 351 | test-push-checkheads-superceed-A8.t |
|
351 | 352 | test-push-checkheads-unpushed-D1.t |
|
352 | 353 | test-push-checkheads-unpushed-D2.t |
|
353 | 354 | test-push-checkheads-unpushed-D3.t |
|
354 | 355 | test-push-checkheads-unpushed-D4.t |
|
355 | 356 | test-push-checkheads-unpushed-D5.t |
|
356 | 357 | test-push-checkheads-unpushed-D6.t |
|
357 | 358 | test-push-checkheads-unpushed-D7.t |
|
358 | 359 | test-push-http.t |
|
359 | 360 | test-push-warn.t |
|
360 | 361 | test-pushvars.t |
|
361 | 362 | test-rebase-abort.t |
|
362 | 363 | test-rebase-base-flag.t |
|
363 | 364 | test-rebase-bookmarks.t |
|
364 | 365 | test-rebase-brute-force.t |
|
365 | 366 | test-rebase-cache.t |
|
366 | 367 | test-rebase-check-restore.t |
|
367 | 368 | test-rebase-collapse.t |
|
368 | 369 | test-rebase-conflicts.t |
|
369 | 370 | test-rebase-dest.t |
|
370 | 371 | test-rebase-detach.t |
|
371 | 372 | test-rebase-emptycommit.t |
|
372 | 373 | test-rebase-inmemory.t |
|
373 | 374 | test-rebase-interruptions.t |
|
374 | 375 | test-rebase-issue-noparam-single-rev.t |
|
375 | 376 | test-rebase-legacy.t |
|
376 | 377 | test-rebase-mq-skip.t |
|
377 | 378 | test-rebase-mq.t |
|
378 | 379 | test-rebase-named-branches.t |
|
379 | 380 | test-rebase-newancestor.t |
|
380 | 381 | test-rebase-obsolete.t |
|
381 | 382 | test-rebase-parameters.t |
|
382 | 383 | test-rebase-partial.t |
|
383 | 384 | test-rebase-pull.t |
|
384 | 385 | test-rebase-rename.t |
|
385 | 386 | test-rebase-scenario-global.t |
|
386 | 387 | test-rebase-templates.t |
|
387 | 388 | test-rebase-transaction.t |
|
388 | 389 | test-record.t |
|
389 | 390 | test-relink.t |
|
390 | 391 | test-remove.t |
|
391 | 392 | test-rename-after-merge.t |
|
392 | 393 | test-rename-dir-merge.t |
|
393 | 394 | test-rename-merge1.t |
|
394 | 395 | test-rename.t |
|
395 | 396 | test-repair-strip.t |
|
396 | 397 | test-repo-compengines.t |
|
397 | 398 | test-resolve.t |
|
398 | 399 | test-revert-flags.t |
|
399 | 400 | test-revert-unknown.t |
|
400 | 401 | test-revlog-ancestry.py |
|
401 | 402 | test-revlog-group-emptyiter.t |
|
402 | 403 | test-revlog-mmapindex.t |
|
403 | 404 | test-revlog-packentry.t |
|
404 | 405 | test-revset-dirstate-parents.t |
|
405 | 406 | test-revset-legacy-lookup.t |
|
406 | 407 | test-revset-outgoing.t |
|
407 | 408 | test-rollback.t |
|
408 | 409 | test-run-tests.py |
|
409 | 410 | test-run-tests.t |
|
410 | 411 | test-schemes.t |
|
411 | 412 | test-serve.t |
|
412 | 413 | test-setdiscovery.t |
|
413 | 414 | test-share.t |
|
414 | 415 | test-shelve.t |
|
415 | 416 | test-show-stack.t |
|
416 | 417 | test-show-work.t |
|
417 | 418 | test-show.t |
|
418 | 419 | test-simple-update.t |
|
419 | 420 | test-simplemerge.py |
|
420 | 421 | test-single-head.t |
|
421 | 422 | test-sparse-clear.t |
|
422 | 423 | test-sparse-import.t |
|
423 | 424 | test-sparse-merges.t |
|
424 | 425 | test-sparse-profiles.t |
|
425 | 426 | test-sparse-requirement.t |
|
426 | 427 | test-sparse-verbose-json.t |
|
427 | 428 | test-ssh-clone-r.t |
|
428 | 429 | test-ssh-proto.t |
|
429 | 430 | test-sshserver.py |
|
430 | 431 | test-stack.t |
|
431 | 432 | test-status-rev.t |
|
432 | 433 | test-status-terse.t |
|
433 | 434 | test-strip-cross.t |
|
434 | 435 | test-strip.t |
|
435 | 436 | test-subrepo-deep-nested-change.t |
|
436 | 437 | test-subrepo-missing.t |
|
437 | 438 | test-subrepo-recursion.t |
|
438 | 439 | test-subrepo-relative-path.t |
|
439 | 440 | test-subrepo.t |
|
440 | 441 | test-symlinks.t |
|
441 | 442 | test-tag.t |
|
442 | 443 | test-tags.t |
|
443 | 444 | test-template-engine.t |
|
444 | 445 | test-treemanifest.t |
|
445 | 446 | test-unamend.t |
|
446 | 447 | test-uncommit.t |
|
447 | 448 | test-unified-test.t |
|
448 | 449 | test-unrelated-pull.t |
|
449 | 450 | test-up-local-change.t |
|
450 | 451 | test-update-branches.t |
|
451 | 452 | test-update-dest.t |
|
452 | 453 | test-update-issue1456.t |
|
453 | 454 | test-update-names.t |
|
454 | 455 | test-update-reverse.t |
|
455 | 456 | test-upgrade-repo.t |
|
456 | 457 | test-url-download.t |
|
457 | 458 | test-url-rev.t |
|
458 | 459 | test-url.py |
|
459 | 460 | test-username-newline.t |
|
460 | 461 | test-verify.t |
|
461 | 462 | test-walkrepo.py |
|
462 | 463 | test-websub.t |
|
463 | 464 | test-win32text.t |
|
464 | 465 | test-wireproto-clientreactor.py |
|
465 | 466 | test-wireproto-framing.py |
|
466 | 467 | test-wireproto-serverreactor.py |
|
467 | 468 | test-wsgirequest.py |
|
468 | 469 | test-xdg.t |
@@ -1,210 +1,210 | |||
|
1 | 1 | from __future__ import absolute_import |
|
2 | 2 | |
|
3 | 3 | import io |
|
4 | 4 | import unittest |
|
5 | 5 | |
|
6 | 6 | from mercurial.thirdparty import ( |
|
7 | 7 | cbor, |
|
8 | 8 | ) |
|
9 | 9 | from mercurial.utils import ( |
|
10 | 10 | cborutil, |
|
11 | 11 | ) |
|
12 | 12 | |
|
13 | 13 | def loadit(it): |
|
14 | 14 | return cbor.loads(b''.join(it)) |
|
15 | 15 | |
|
16 | 16 | class BytestringTests(unittest.TestCase): |
|
17 | 17 | def testsimple(self): |
|
18 | 18 | self.assertEqual( |
|
19 | 19 | list(cborutil.streamencode(b'foobar')), |
|
20 | 20 | [b'\x46', b'foobar']) |
|
21 | 21 | |
|
22 | 22 | self.assertEqual( |
|
23 | 23 | loadit(cborutil.streamencode(b'foobar')), |
|
24 | 24 | b'foobar') |
|
25 | 25 | |
|
26 | 26 | def testlong(self): |
|
27 | 27 | source = b'x' * 1048576 |
|
28 | 28 | |
|
29 | 29 | self.assertEqual(loadit(cborutil.streamencode(source)), source) |
|
30 | 30 | |
|
31 | 31 | def testfromiter(self): |
|
32 | 32 | # This is the example from RFC 7049 Section 2.2.2. |
|
33 | 33 | source = [b'\xaa\xbb\xcc\xdd', b'\xee\xff\x99'] |
|
34 | 34 | |
|
35 | 35 | self.assertEqual( |
|
36 | 36 | list(cborutil.streamencodebytestringfromiter(source)), |
|
37 | 37 | [ |
|
38 | 38 | b'\x5f', |
|
39 | 39 | b'\x44', |
|
40 | 40 | b'\xaa\xbb\xcc\xdd', |
|
41 | 41 | b'\x43', |
|
42 | 42 | b'\xee\xff\x99', |
|
43 | 43 | b'\xff', |
|
44 | 44 | ]) |
|
45 | 45 | |
|
46 | 46 | self.assertEqual( |
|
47 | 47 | loadit(cborutil.streamencodebytestringfromiter(source)), |
|
48 | 48 | b''.join(source)) |
|
49 | 49 | |
|
50 | 50 | def testfromiterlarge(self): |
|
51 | 51 | source = [b'a' * 16, b'b' * 128, b'c' * 1024, b'd' * 1048576] |
|
52 | 52 | |
|
53 | 53 | self.assertEqual( |
|
54 | 54 | loadit(cborutil.streamencodebytestringfromiter(source)), |
|
55 | 55 | b''.join(source)) |
|
56 | 56 | |
|
57 | 57 | def testindefinite(self): |
|
58 | 58 | source = b'\x00\x01\x02\x03' + b'\xff' * 16384 |
|
59 | 59 | |
|
60 | 60 | it = cborutil.streamencodeindefinitebytestring(source, chunksize=2) |
|
61 | 61 | |
|
62 | 62 | self.assertEqual(next(it), b'\x5f') |
|
63 | 63 | self.assertEqual(next(it), b'\x42') |
|
64 | 64 | self.assertEqual(next(it), b'\x00\x01') |
|
65 | 65 | self.assertEqual(next(it), b'\x42') |
|
66 | 66 | self.assertEqual(next(it), b'\x02\x03') |
|
67 | 67 | self.assertEqual(next(it), b'\x42') |
|
68 | 68 | self.assertEqual(next(it), b'\xff\xff') |
|
69 | 69 | |
|
70 | 70 | dest = b''.join(cborutil.streamencodeindefinitebytestring( |
|
71 | 71 | source, chunksize=42)) |
|
72 |
self.assertEqual(cbor.loads(dest), |
|
|
72 | self.assertEqual(cbor.loads(dest), source) | |
|
73 | 73 | |
|
74 | 74 | def testreadtoiter(self): |
|
75 | 75 | source = io.BytesIO(b'\x5f\x44\xaa\xbb\xcc\xdd\x43\xee\xff\x99\xff') |
|
76 | 76 | |
|
77 | 77 | it = cborutil.readindefinitebytestringtoiter(source) |
|
78 | 78 | self.assertEqual(next(it), b'\xaa\xbb\xcc\xdd') |
|
79 | 79 | self.assertEqual(next(it), b'\xee\xff\x99') |
|
80 | 80 | |
|
81 | 81 | with self.assertRaises(StopIteration): |
|
82 | 82 | next(it) |
|
83 | 83 | |
|
84 | 84 | class IntTests(unittest.TestCase): |
|
85 | 85 | def testsmall(self): |
|
86 | 86 | self.assertEqual(list(cborutil.streamencode(0)), [b'\x00']) |
|
87 | 87 | self.assertEqual(list(cborutil.streamencode(1)), [b'\x01']) |
|
88 | 88 | self.assertEqual(list(cborutil.streamencode(2)), [b'\x02']) |
|
89 | 89 | self.assertEqual(list(cborutil.streamencode(3)), [b'\x03']) |
|
90 | 90 | self.assertEqual(list(cborutil.streamencode(4)), [b'\x04']) |
|
91 | 91 | |
|
92 | 92 | def testnegativesmall(self): |
|
93 | 93 | self.assertEqual(list(cborutil.streamencode(-1)), [b'\x20']) |
|
94 | 94 | self.assertEqual(list(cborutil.streamencode(-2)), [b'\x21']) |
|
95 | 95 | self.assertEqual(list(cborutil.streamencode(-3)), [b'\x22']) |
|
96 | 96 | self.assertEqual(list(cborutil.streamencode(-4)), [b'\x23']) |
|
97 | 97 | self.assertEqual(list(cborutil.streamencode(-5)), [b'\x24']) |
|
98 | 98 | |
|
99 | 99 | def testrange(self): |
|
100 | 100 | for i in range(-70000, 70000, 10): |
|
101 | 101 | self.assertEqual( |
|
102 | 102 | b''.join(cborutil.streamencode(i)), |
|
103 | 103 | cbor.dumps(i)) |
|
104 | 104 | |
|
105 | 105 | class ArrayTests(unittest.TestCase): |
|
106 | 106 | def testempty(self): |
|
107 | 107 | self.assertEqual(list(cborutil.streamencode([])), [b'\x80']) |
|
108 | 108 | self.assertEqual(loadit(cborutil.streamencode([])), []) |
|
109 | 109 | |
|
110 | 110 | def testbasic(self): |
|
111 | 111 | source = [b'foo', b'bar', 1, -10] |
|
112 | 112 | |
|
113 | 113 | self.assertEqual(list(cborutil.streamencode(source)), [ |
|
114 | 114 | b'\x84', b'\x43', b'foo', b'\x43', b'bar', b'\x01', b'\x29']) |
|
115 | 115 | |
|
116 | 116 | def testemptyfromiter(self): |
|
117 | 117 | self.assertEqual(b''.join(cborutil.streamencodearrayfromiter([])), |
|
118 | 118 | b'\x9f\xff') |
|
119 | 119 | |
|
120 | 120 | def testfromiter1(self): |
|
121 | 121 | source = [b'foo'] |
|
122 | 122 | |
|
123 | 123 | self.assertEqual(list(cborutil.streamencodearrayfromiter(source)), [ |
|
124 | 124 | b'\x9f', |
|
125 | 125 | b'\x43', b'foo', |
|
126 | 126 | b'\xff', |
|
127 | 127 | ]) |
|
128 | 128 | |
|
129 | 129 | dest = b''.join(cborutil.streamencodearrayfromiter(source)) |
|
130 | 130 | self.assertEqual(cbor.loads(dest), source) |
|
131 | 131 | |
|
132 | 132 | def testtuple(self): |
|
133 | 133 | source = (b'foo', None, 42) |
|
134 | 134 | |
|
135 | 135 | self.assertEqual(cbor.loads(b''.join(cborutil.streamencode(source))), |
|
136 | 136 | list(source)) |
|
137 | 137 | |
|
138 | 138 | class SetTests(unittest.TestCase): |
|
139 | 139 | def testempty(self): |
|
140 | 140 | self.assertEqual(list(cborutil.streamencode(set())), [ |
|
141 | 141 | b'\xd9\x01\x02', |
|
142 | 142 | b'\x80', |
|
143 | 143 | ]) |
|
144 | 144 | |
|
145 | 145 | def testset(self): |
|
146 | 146 | source = {b'foo', None, 42} |
|
147 | 147 | |
|
148 | 148 | self.assertEqual(cbor.loads(b''.join(cborutil.streamencode(source))), |
|
149 | 149 | source) |
|
150 | 150 | |
|
151 | 151 | class BoolTests(unittest.TestCase): |
|
152 | 152 | def testbasic(self): |
|
153 | 153 | self.assertEqual(list(cborutil.streamencode(True)), [b'\xf5']) |
|
154 | 154 | self.assertEqual(list(cborutil.streamencode(False)), [b'\xf4']) |
|
155 | 155 | |
|
156 | 156 | self.assertIs(loadit(cborutil.streamencode(True)), True) |
|
157 | 157 | self.assertIs(loadit(cborutil.streamencode(False)), False) |
|
158 | 158 | |
|
159 | 159 | class NoneTests(unittest.TestCase): |
|
160 | 160 | def testbasic(self): |
|
161 | 161 | self.assertEqual(list(cborutil.streamencode(None)), [b'\xf6']) |
|
162 | 162 | |
|
163 | 163 | self.assertIs(loadit(cborutil.streamencode(None)), None) |
|
164 | 164 | |
|
165 | 165 | class MapTests(unittest.TestCase): |
|
166 | 166 | def testempty(self): |
|
167 | 167 | self.assertEqual(list(cborutil.streamencode({})), [b'\xa0']) |
|
168 | 168 | self.assertEqual(loadit(cborutil.streamencode({})), {}) |
|
169 | 169 | |
|
170 | 170 | def testemptyindefinite(self): |
|
171 | 171 | self.assertEqual(list(cborutil.streamencodemapfromiter([])), [ |
|
172 | 172 | b'\xbf', b'\xff']) |
|
173 | 173 | |
|
174 | 174 | self.assertEqual(loadit(cborutil.streamencodemapfromiter([])), {}) |
|
175 | 175 | |
|
176 | 176 | def testone(self): |
|
177 | 177 | source = {b'foo': b'bar'} |
|
178 | 178 | self.assertEqual(list(cborutil.streamencode(source)), [ |
|
179 | 179 | b'\xa1', b'\x43', b'foo', b'\x43', b'bar']) |
|
180 | 180 | |
|
181 | 181 | self.assertEqual(loadit(cborutil.streamencode(source)), source) |
|
182 | 182 | |
|
183 | 183 | def testmultiple(self): |
|
184 | 184 | source = { |
|
185 | 185 | b'foo': b'bar', |
|
186 | 186 | b'baz': b'value1', |
|
187 | 187 | } |
|
188 | 188 | |
|
189 | 189 | self.assertEqual(loadit(cborutil.streamencode(source)), source) |
|
190 | 190 | |
|
191 | 191 | self.assertEqual( |
|
192 | 192 | loadit(cborutil.streamencodemapfromiter(source.items())), |
|
193 | 193 | source) |
|
194 | 194 | |
|
195 | 195 | def testcomplex(self): |
|
196 | 196 | source = { |
|
197 | 197 | b'key': 1, |
|
198 | 198 | 2: -10, |
|
199 | 199 | } |
|
200 | 200 | |
|
201 | 201 | self.assertEqual(loadit(cborutil.streamencode(source)), |
|
202 | 202 | source) |
|
203 | 203 | |
|
204 | 204 | self.assertEqual( |
|
205 | 205 | loadit(cborutil.streamencodemapfromiter(source.items())), |
|
206 | 206 | source) |
|
207 | 207 | |
|
208 | 208 | if __name__ == '__main__': |
|
209 | 209 | import silenttestrunner |
|
210 | 210 | silenttestrunner.main(__name__) |
General Comments 0
You need to be logged in to leave comments.
Login now