Mercurial > hg
comparison tests/test-pathencode.py @ 28918:72f683260f31
tests: make test-pathencode use print_function
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 14 Apr 2016 01:06:45 +0530 |
parents | a6eb4e481134 |
children | 59481bfdb7f3 |
comparison
equal
deleted
inserted
replaced
28917:f798ffe7cb08 | 28918:72f683260f31 |
---|---|
2 # time it is invoked, and tests the encoding of those pathnames. | 2 # time it is invoked, and tests the encoding of those pathnames. |
3 # | 3 # |
4 # It uses a simple probabilistic model to generate valid pathnames | 4 # It uses a simple probabilistic model to generate valid pathnames |
5 # that have proven likely to expose bugs and divergent behavior in | 5 # that have proven likely to expose bugs and divergent behavior in |
6 # different encoding implementations. | 6 # different encoding implementations. |
7 | |
8 from __future__ import print_function | |
7 | 9 |
8 from mercurial import store | 10 from mercurial import store |
9 import binascii, itertools, math, os, random, sys, time | 11 import binascii, itertools, math, os, random, sys, time |
10 import collections | 12 import collections |
11 | 13 |
152 for p in genpath(rng, count): | 154 for p in genpath(rng, count): |
153 h = store._pathencode(p) # uses C implementation, if available | 155 h = store._pathencode(p) # uses C implementation, if available |
154 r = store._hybridencode(p, True) # reference implementation in Python | 156 r = store._hybridencode(p, True) # reference implementation in Python |
155 if h != r: | 157 if h != r: |
156 if nerrs == 0: | 158 if nerrs == 0: |
157 print >> sys.stderr, 'seed:', hex(seed)[:-1] | 159 print('seed:', hex(seed)[:-1], file=sys.stderr) |
158 print >> sys.stderr, "\np: '%s'" % p.encode("string_escape") | 160 print("\np: '%s'" % p.encode("string_escape"), file=sys.stderr) |
159 print >> sys.stderr, "h: '%s'" % h.encode("string_escape") | 161 print("h: '%s'" % h.encode("string_escape"), file=sys.stderr) |
160 print >> sys.stderr, "r: '%s'" % r.encode("string_escape") | 162 print("r: '%s'" % r.encode("string_escape"), file=sys.stderr) |
161 nerrs += 1 | 163 nerrs += 1 |
162 return nerrs | 164 return nerrs |
163 | 165 |
164 def main(): | 166 def main(): |
165 import getopt | 167 import getopt |