##// END OF EJS Templates
tests: port test-minirst.py to Python 3...
Augie Fackler -
r37899:3d24f708 default
parent child Browse files
Show More
@@ -7,7 +7,7 b' from mercurial.utils import ('
7 7 )
8 8
9 9 def debugformat(text, form, **kwargs):
10 if form == 'html':
10 if form == b'html':
11 11 print("html format:")
12 12 out = minirst.format(text, style=form, **kwargs)
13 13 else:
@@ -16,11 +16,11 b' def debugformat(text, form, **kwargs):'
16 16
17 17 print("-" * 70)
18 18 if type(out) == tuple:
19 print(out[0][:-1])
19 print(out[0][:-1].decode('utf8'))
20 20 print("-" * 70)
21 print(stringutil.pprint(out[1], bprefix=False))
21 print(stringutil.pprint(out[1], bprefix=False).decode('utf8'))
22 22 else:
23 print(out[:-1])
23 print(out[:-1].decode('utf8'))
24 24 print("-" * 70)
25 25 print()
26 26
@@ -28,7 +28,7 b' def debugformats(title, text, **kwargs):'
28 28 print("== %s ==" % title)
29 29 debugformat(text, 60, **kwargs)
30 30 debugformat(text, 30, **kwargs)
31 debugformat(text, 'html', **kwargs)
31 debugformat(text, b'html', **kwargs)
32 32
33 33 paragraphs = b"""
34 34 This is some text in the first paragraph.
@@ -39,7 +39,7 b' This is some text in the first paragraph'
39 39 \n \n \nThe third and final paragraph.
40 40 """
41 41
42 debugformats(b'paragraphs', paragraphs)
42 debugformats('paragraphs', paragraphs)
43 43
44 44 definitions = b"""
45 45 A Term
@@ -54,7 +54,7 b' Another Term'
54 54 Definition.
55 55 """
56 56
57 debugformats(b'definitions', definitions)
57 debugformats('definitions', definitions)
58 58
59 59 literals = br"""
60 60 The fully minimized form is the most
@@ -78,7 +78,7 b' simply ends with space-double-colon. ::'
78 78 with '::' disappears in the final output.
79 79 """
80 80
81 debugformats(b'literals', literals)
81 debugformats('literals', literals)
82 82
83 83 lists = b"""
84 84 - This is the first list item.
@@ -129,7 +129,7 b' Bullet lists are also detected:'
129 129 * This is the third bullet
130 130 """
131 131
132 debugformats(b'lists', lists)
132 debugformats('lists', lists)
133 133
134 134 options = b"""
135 135 There is support for simple option lists,
@@ -155,7 +155,7 b' marker after the option. It is treated a'
155 155 --foo bar baz
156 156 """
157 157
158 debugformats(b'options', options)
158 debugformats('options', options)
159 159
160 160 fields = b"""
161 161 :a: First item.
@@ -168,7 +168,7 b' Next list:'
168 168 :much too large: This key is big enough to get its own line.
169 169 """
170 170
171 debugformats(b'fields', fields)
171 debugformats('fields', fields)
172 172
173 173 containers = b"""
174 174 Normal output.
@@ -186,14 +186,14 b' Normal output.'
186 186 Debug output.
187 187 """
188 188
189 debugformats(b'containers (normal)', containers)
190 debugformats(b'containers (verbose)', containers, keep=['verbose'])
191 debugformats(b'containers (debug)', containers, keep=['debug'])
192 debugformats(b'containers (verbose debug)', containers,
193 keep=['verbose', 'debug'])
189 debugformats('containers (normal)', containers)
190 debugformats('containers (verbose)', containers, keep=[b'verbose'])
191 debugformats('containers (debug)', containers, keep=[b'debug'])
192 debugformats('containers (verbose debug)', containers,
193 keep=[b'verbose', b'debug'])
194 194
195 195 roles = b"""Please see :hg:`add`."""
196 debugformats(b'roles', roles)
196 debugformats('roles', roles)
197 197
198 198
199 199 sections = b"""
@@ -209,7 +209,7 b' Subsection'
209 209 Markup: ``foo`` and :hg:`help`
210 210 ------------------------------
211 211 """
212 debugformats(b'sections', sections)
212 debugformats('sections', sections)
213 213
214 214
215 215 admonitions = b"""
@@ -227,7 +227,7 b' admonitions = b"""'
227 227 This is danger
228 228 """
229 229
230 debugformats(b'admonitions', admonitions)
230 debugformats('admonitions', admonitions)
231 231
232 232 comments = b"""
233 233 Some text.
@@ -243,7 +243,7 b' Some text.'
243 243 Empty comment above
244 244 """
245 245
246 debugformats(b'comments', comments)
246 debugformats('comments', comments)
247 247
248 248
249 249 data = [[b'a', b'b', b'c'],
@@ -253,9 +253,9 b" data = [[b'a', b'b', b'c'],"
253 253 rst = minirst.maketable(data, 2, True)
254 254 table = b''.join(rst)
255 255
256 print(table)
256 print(table.decode('utf8'))
257 257
258 debugformats(b'table', table)
258 debugformats('table', table)
259 259
260 260 data = [[b's', b'long', b'line\ngoes on here'],
261 261 [b'', b'xy', b'tried to fix here\n by indenting']]
@@ -263,6 +263,6 b" data = [[b's', b'long', b'line\\ngoes on "
263 263 rst = minirst.maketable(data, 1, False)
264 264 table = b''.join(rst)
265 265
266 print(table)
266 print(table.decode('utf8'))
267 267
268 debugformats(b'table+nl', table)
268 debugformats('table+nl', table)
General Comments 0
You need to be logged in to leave comments. Login now