Mercurial > hg
comparison hgext/convert/convcmd.py @ 34131:0fa781320203
doctest: bulk-replace string literals with b'' for Python 3
Our code transformer can't rewrite string literals in docstrings, and I
don't want to make the transformer more complex.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 03 Sep 2017 14:32:11 +0900 |
parents | d1a0a64f6e16 |
children | ee10eb665036 |
comparison
equal
deleted
inserted
replaced
34130:ada8a19672ab | 34131:0fa781320203 |
---|---|
57 else: | 57 else: |
58 return s.decode('utf-8').encode(orig_encoding, 'replace') | 58 return s.decode('utf-8').encode(orig_encoding, 'replace') |
59 | 59 |
60 def mapbranch(branch, branchmap): | 60 def mapbranch(branch, branchmap): |
61 ''' | 61 ''' |
62 >>> bmap = {'default': 'branch1'} | 62 >>> bmap = {b'default': b'branch1'} |
63 >>> for i in ['', None]: | 63 >>> for i in [b'', None]: |
64 ... mapbranch(i, bmap) | 64 ... mapbranch(i, bmap) |
65 'branch1' | 65 'branch1' |
66 'branch1' | 66 'branch1' |
67 >>> bmap = {'None': 'branch2'} | 67 >>> bmap = {b'None': b'branch2'} |
68 >>> for i in ['', None]: | 68 >>> for i in [b'', None]: |
69 ... mapbranch(i, bmap) | 69 ... mapbranch(i, bmap) |
70 'branch2' | 70 'branch2' |
71 'branch2' | 71 'branch2' |
72 >>> bmap = {'None': 'branch3', 'default': 'branch4'} | 72 >>> bmap = {b'None': b'branch3', b'default': b'branch4'} |
73 >>> for i in ['None', '', None, 'default', 'branch5']: | 73 >>> for i in [b'None', b'', None, b'default', b'branch5']: |
74 ... mapbranch(i, bmap) | 74 ... mapbranch(i, bmap) |
75 'branch3' | 75 'branch3' |
76 'branch4' | 76 'branch4' |
77 'branch4' | 77 'branch4' |
78 'branch4' | 78 'branch4' |