Show More
@@ -247,6 +247,7 def trim(s, width, ellipsis='', leftside | |||
|
247 | 247 | If 'leftside' is True, left side of string 's' is trimmed. |
|
248 | 248 | 'ellipsis' is always placed at trimmed side. |
|
249 | 249 | |
|
250 | >>> from .node import bin | |
|
250 | 251 | >>> ellipsis = b'+++' |
|
251 | 252 | >>> from . import encoding |
|
252 | 253 | >>> encoding.encoding = b'utf-8' |
@@ -285,7 +286,7 def trim(s, width, ellipsis='', leftside | |||
|
285 | 286 | +++ |
|
286 | 287 | >>> print trim(t, 4, ellipsis=ellipsis, leftside=True) |
|
287 | 288 | +++ |
|
288 |
>>> t = b' |
|
|
289 | >>> t = bin(b'112233445566778899aa') # invalid byte sequence | |
|
289 | 290 | >>> print trim(t, 12, ellipsis=ellipsis) |
|
290 | 291 | \x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa |
|
291 | 292 | >>> print trim(t, 10, ellipsis=ellipsis) |
@@ -95,7 +95,7 def _buildencodefun(): | |||
|
95 | 95 | >>> dec(b'hello~3aworld~3f') |
|
96 | 96 | 'hello:world?' |
|
97 | 97 | |
|
98 | >>> enc(b'the\x07quick\xADshot') | |
|
98 | >>> enc(b'the\\x07quick\\xADshot') | |
|
99 | 99 | 'the~07quick~adshot' |
|
100 | 100 | >>> dec(b'the~07quick~adshot') |
|
101 | 101 | 'the\\x07quick\\xadshot' |
@@ -154,7 +154,7 def _buildlowerencodefun(): | |||
|
154 | 154 | 'hello' |
|
155 | 155 | >>> f(b'hello:world?') |
|
156 | 156 | 'hello~3aworld~3f' |
|
157 | >>> f(b'the\x07quick\xADshot') | |
|
157 | >>> f(b'the\\x07quick\\xADshot') | |
|
158 | 158 | 'the~07quick~adshot' |
|
159 | 159 | ''' |
|
160 | 160 | cmap = dict([(chr(x), chr(x)) for x in xrange(127)]) |
General Comments 0
You need to be logged in to leave comments.
Login now