@zzzen/pyright-internal 1.2.0-dev.20240609 → 1.2.0-dev.20240616
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/binder.d.ts +3 -1
- package/dist/analyzer/binder.js +9 -3
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +3 -3
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +1 -4
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructors.js +0 -2
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +0 -1
- package/dist/analyzer/dataClasses.js +51 -77
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/decorators.d.ts +2 -1
- package/dist/analyzer/decorators.js +34 -39
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/docStringUtils.d.ts +0 -1
- package/dist/analyzer/docStringUtils.js +1 -6
- package/dist/analyzer/docStringUtils.js.map +1 -1
- package/dist/analyzer/enums.js +1 -1
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.js +11 -9
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/namedTuples.js +3 -3
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/properties.js +2 -2
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +14 -3
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/service.js +27 -48
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +2 -1
- package/dist/analyzer/sourceFile.js +4 -2
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.d.ts +1 -0
- package/dist/analyzer/typeDocStringUtils.js +8 -1
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +468 -459
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typePrinter.js +4 -2
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +0 -1
- package/dist/analyzer/typeUtils.js +9 -22
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +6 -6
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +40 -42
- package/dist/analyzer/types.js +84 -91
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +16 -24
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/cancellationUtils.d.ts +1 -0
- package/dist/common/cancellationUtils.js +15 -1
- package/dist/common/cancellationUtils.js.map +1 -1
- package/dist/common/configOptions.js +1 -1
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/docStringService.d.ts +15 -0
- package/dist/common/docStringService.js +38 -0
- package/dist/common/docStringService.js.map +1 -0
- package/dist/common/envVarUtils.js +3 -1
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +1 -7
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +1 -2
- package/dist/common/languageServerInterface.js.map +1 -1
- package/dist/common/serviceKeys.d.ts +2 -0
- package/dist/common/serviceKeys.js +1 -0
- package/dist/common/serviceKeys.js.map +1 -1
- package/dist/common/serviceProvider.js +3 -0
- package/dist/common/serviceProvider.js.map +1 -1
- package/dist/common/serviceProviderExtensions.d.ts +2 -0
- package/dist/common/serviceProviderExtensions.js +8 -0
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/stringUtils.d.ts +1 -0
- package/dist/common/stringUtils.js +5 -1
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/uri/uriUtils.d.ts +1 -1
- package/dist/common/uri/uriUtils.js +1 -1
- package/dist/common/uri/uriUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +1 -1
- package/dist/languageServerBase.js +2 -2
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +1 -0
- package/dist/languageService/completionProvider.js +16 -7
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +2 -1
- package/dist/languageService/completionProviderUtils.js +6 -4
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +2 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +2 -1
- package/dist/languageService/hoverProvider.js +7 -5
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +3 -1
- package/dist/languageService/signatureHelpProvider.js +8 -6
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/localization/package.nls.cs.json +2 -1
- package/dist/localization/package.nls.de.json +2 -1
- package/dist/localization/package.nls.es.json +1 -0
- package/dist/localization/package.nls.fr.json +2 -1
- package/dist/localization/package.nls.it.json +2 -1
- package/dist/localization/package.nls.ja.json +2 -1
- package/dist/localization/package.nls.ko.json +2 -1
- package/dist/localization/package.nls.pl.json +2 -1
- package/dist/localization/package.nls.pt-br.json +2 -1
- package/dist/localization/package.nls.qps-ploc.json +2 -1
- package/dist/localization/package.nls.ru.json +2 -1
- package/dist/localization/package.nls.tr.json +2 -1
- package/dist/localization/package.nls.zh-cn.json +2 -1
- package/dist/localization/package.nls.zh-tw.json +2 -1
- package/dist/tests/checker.test.js +8 -0
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/config.test.js +1 -1
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.d.ts +2 -1
- package/dist/tests/docStringConversion.test.js +300 -293
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js +2 -2
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +2 -1
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/pathUtils.test.js +6 -0
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/signatureHelp.test.js +2 -1
- package/dist/tests/signatureHelp.test.js.map +1 -1
- package/dist/tests/uri.test.js +6 -0
- package/dist/tests/uri.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +1 -1
- package/package.json +1 -1
- package/dist/tests/docStringUtils.test.d.ts +0 -1
- package/dist/tests/docStringUtils.test.js +0 -74
- package/dist/tests/docStringUtils.test.js.map +0 -1
@@ -7,59 +7,61 @@
|
|
7
7
|
* Tests for the Python doc string to markdown converter.
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.docStringTests = void 0;
|
10
11
|
const assert = require("assert");
|
11
|
-
const
|
12
|
+
const docStringService_1 = require("../common/docStringService");
|
12
13
|
// For substitution in the test data strings
|
13
14
|
// Produces more readable test data than escaping the back ticks
|
14
15
|
const singleTick = '`';
|
15
16
|
const doubleTick = '``';
|
16
17
|
const tripleTick = '```';
|
17
18
|
const tripleTilda = '~~~';
|
18
|
-
|
19
|
-
|
20
|
-
[
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
]
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
[
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
]
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
19
|
+
function docStringTests(docStringService = new docStringService_1.PyrightDocStringService()) {
|
20
|
+
test('PlaintextIndention', () => {
|
21
|
+
const all = [
|
22
|
+
['A\nB', 'A\nB'],
|
23
|
+
['A\n\nB', 'A\n\nB'],
|
24
|
+
['A\n B', 'A\nB'],
|
25
|
+
[' A\n B', 'A\nB'],
|
26
|
+
['\nA\n B', 'A\n B'],
|
27
|
+
['\n A\n B', 'A\nB'],
|
28
|
+
['\nA\nB\n', 'A\nB'],
|
29
|
+
[' \n\nA \n \nB \n ', 'A\n\nB'],
|
30
|
+
];
|
31
|
+
all.forEach((v) => _testConvertToPlainText(v[0], v[1]));
|
32
|
+
});
|
33
|
+
test('MarkdownIndention', () => {
|
34
|
+
const all = [
|
35
|
+
['A\nB', 'A\nB'],
|
36
|
+
['A\n\nB', 'A\n\nB'],
|
37
|
+
['A\n B', 'A\nB'],
|
38
|
+
[' A\n B', 'A\nB'],
|
39
|
+
['\nA\n B', 'A \n B'],
|
40
|
+
['\n A\n B', 'A\nB'],
|
41
|
+
['\nA\nB\n', 'A\nB'],
|
42
|
+
[' \n\nA \n \nB \n ', 'A\n\nB'],
|
43
|
+
];
|
44
|
+
all.forEach((v) => _testConvertToMarkdown(v[0], v[1]));
|
45
|
+
});
|
46
|
+
test('NormalText', () => {
|
47
|
+
const docstring = `This is just some normal text
|
46
48
|
that extends over multiple lines. This will appear
|
47
49
|
as-is without modification.
|
48
50
|
`;
|
49
|
-
|
51
|
+
const markdown = `This is just some normal text
|
50
52
|
that extends over multiple lines. This will appear
|
51
53
|
as-is without modification.
|
52
54
|
`;
|
53
|
-
|
54
|
-
});
|
55
|
-
test('InlineLiterals', () => {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
});
|
61
|
-
test('Headings', () => {
|
62
|
-
|
55
|
+
_testConvertToMarkdown(docstring, markdown);
|
56
|
+
});
|
57
|
+
test('InlineLiterals', () => {
|
58
|
+
const docstring = 'This paragraph talks about ``foo``\n' +
|
59
|
+
'which is related to :something:`bar`, and probably `qux`:something_else:.\n';
|
60
|
+
const markdown = 'This paragraph talks about `foo` \n' + 'which is related to `bar`, and probably `qux`.\n';
|
61
|
+
_testConvertToMarkdown(docstring, markdown);
|
62
|
+
});
|
63
|
+
test('Headings', () => {
|
64
|
+
const docstring = `Heading 1
|
63
65
|
=========
|
64
66
|
|
65
67
|
Heading 2
|
@@ -71,7 +73,7 @@ Heading 3
|
|
71
73
|
Heading 4
|
72
74
|
+++++++++
|
73
75
|
`;
|
74
|
-
|
76
|
+
const markdown = `Heading 1
|
75
77
|
=========
|
76
78
|
|
77
79
|
Heading 2
|
@@ -83,40 +85,40 @@ Heading 3
|
|
83
85
|
Heading 4
|
84
86
|
---------
|
85
87
|
`;
|
86
|
-
|
87
|
-
});
|
88
|
-
test('AsterisksAtStartOfArgs', () => {
|
89
|
-
|
88
|
+
_testConvertToMarkdown(docstring, markdown);
|
89
|
+
});
|
90
|
+
test('AsterisksAtStartOfArgs', () => {
|
91
|
+
const docstring = `Foo:
|
90
92
|
|
91
93
|
Args:
|
92
94
|
foo (Foo): Foo!
|
93
95
|
*args: These are positional args.
|
94
96
|
**kwargs: These are named args.
|
95
97
|
`;
|
96
|
-
|
98
|
+
const markdown = `Foo:
|
97
99
|
|
98
100
|
Args:
|
99
101
|
foo (Foo): Foo!
|
100
102
|
\\*args: These are positional args.
|
101
103
|
\\*\\*kwargs: These are named args.
|
102
104
|
`;
|
103
|
-
|
104
|
-
});
|
105
|
-
test('CopyrightAndLicense', () => {
|
106
|
-
|
105
|
+
_testConvertToMarkdown(docstring, markdown);
|
106
|
+
});
|
107
|
+
test('CopyrightAndLicense', () => {
|
108
|
+
const docstring = `This is a test.
|
107
109
|
|
108
110
|
:copyright: Fake Name
|
109
111
|
:license: ABCv123
|
110
112
|
`;
|
111
|
-
|
113
|
+
const markdown = `This is a test.
|
112
114
|
|
113
115
|
:copyright: Fake Name
|
114
116
|
:license: ABCv123
|
115
117
|
`;
|
116
|
-
|
117
|
-
});
|
118
|
-
test('CommonRestFieldLists', () => {
|
119
|
-
|
118
|
+
_testConvertToMarkdown(docstring, markdown);
|
119
|
+
});
|
120
|
+
test('CommonRestFieldLists', () => {
|
121
|
+
const docstring = `This function does something.
|
120
122
|
|
121
123
|
:param foo: This is a description of the foo parameter
|
122
124
|
which does something interesting.
|
@@ -127,7 +129,7 @@ test('CommonRestFieldLists', () => {
|
|
127
129
|
:rtype: Something
|
128
130
|
:raises ValueError: If something goes wrong.
|
129
131
|
`;
|
130
|
-
|
132
|
+
const markdown = `This function does something.
|
131
133
|
|
132
134
|
:param foo: This is a description of the foo parameter
|
133
135
|
which does something interesting.
|
@@ -138,47 +140,47 @@ test('CommonRestFieldLists', () => {
|
|
138
140
|
:rtype: Something
|
139
141
|
:raises ValueError: If something goes wrong.
|
140
142
|
`;
|
141
|
-
|
142
|
-
});
|
143
|
-
test('Doctest', () => {
|
144
|
-
|
143
|
+
_testConvertToMarkdown(docstring, markdown);
|
144
|
+
});
|
145
|
+
test('Doctest', () => {
|
146
|
+
const docstring = `This is a doctest:
|
145
147
|
|
146
148
|
>>> print('foo')
|
147
149
|
foo
|
148
150
|
`;
|
149
|
-
|
151
|
+
const markdown = `This is a doctest:
|
150
152
|
|
151
153
|
${tripleTick}
|
152
154
|
>>> print('foo')
|
153
155
|
foo
|
154
156
|
${tripleTick}
|
155
157
|
`;
|
156
|
-
|
157
|
-
});
|
158
|
-
test('DoctestIndented', () => {
|
159
|
-
|
158
|
+
_testConvertToMarkdown(docstring, markdown);
|
159
|
+
});
|
160
|
+
test('DoctestIndented', () => {
|
161
|
+
const docstring = `This is a doctest:
|
160
162
|
|
161
163
|
>>> print('foo')
|
162
164
|
foo
|
163
165
|
`;
|
164
|
-
|
166
|
+
const markdown = `This is a doctest:
|
165
167
|
|
166
168
|
${tripleTick}
|
167
169
|
>>> print('foo')
|
168
170
|
foo
|
169
171
|
${tripleTick}
|
170
172
|
`;
|
171
|
-
|
172
|
-
});
|
173
|
-
test('DoctestTextAfter', () => {
|
174
|
-
|
173
|
+
_testConvertToMarkdown(docstring, markdown);
|
174
|
+
});
|
175
|
+
test('DoctestTextAfter', () => {
|
176
|
+
const docstring = `This is a doctest:
|
175
177
|
|
176
178
|
>>> print('foo')
|
177
179
|
foo
|
178
180
|
|
179
181
|
This text comes after.
|
180
182
|
`;
|
181
|
-
|
183
|
+
const markdown = `This is a doctest:
|
182
184
|
|
183
185
|
${tripleTick}
|
184
186
|
>>> print('foo')
|
@@ -187,16 +189,16 @@ ${tripleTick}
|
|
187
189
|
|
188
190
|
This text comes after.
|
189
191
|
`;
|
190
|
-
|
191
|
-
});
|
192
|
-
test('DoctestIndentedTextAfter', () => {
|
193
|
-
|
192
|
+
_testConvertToMarkdown(docstring, markdown);
|
193
|
+
});
|
194
|
+
test('DoctestIndentedTextAfter', () => {
|
195
|
+
const docstring = `This is a doctest:
|
194
196
|
|
195
197
|
>>> print('foo')
|
196
198
|
foo
|
197
199
|
This line has a different indent.
|
198
200
|
`;
|
199
|
-
|
201
|
+
const markdown = `This is a doctest:
|
200
202
|
|
201
203
|
${tripleTick}
|
202
204
|
>>> print('foo')
|
@@ -205,10 +207,10 @@ ${tripleTick}
|
|
205
207
|
|
206
208
|
This line has a different indent.
|
207
209
|
`;
|
208
|
-
|
209
|
-
});
|
210
|
-
test('MarkdownStyleBacktickBlock', () => {
|
211
|
-
|
210
|
+
_testConvertToMarkdown(docstring, markdown);
|
211
|
+
});
|
212
|
+
test('MarkdownStyleBacktickBlock', () => {
|
213
|
+
const docstring = `Backtick block:
|
212
214
|
|
213
215
|
${tripleTick}
|
214
216
|
print(foo_bar)
|
@@ -219,7 +221,7 @@ ${tripleTick}
|
|
219
221
|
|
220
222
|
And some text after.
|
221
223
|
`;
|
222
|
-
|
224
|
+
const markdown = `Backtick block:
|
223
225
|
|
224
226
|
${tripleTick}
|
225
227
|
print(foo_bar)
|
@@ -230,10 +232,10 @@ ${tripleTick}
|
|
230
232
|
|
231
233
|
And some text after.
|
232
234
|
`;
|
233
|
-
|
234
|
-
});
|
235
|
-
test('MarkdownStyleTildaBlock', () => {
|
236
|
-
|
235
|
+
_testConvertToMarkdown(docstring, markdown);
|
236
|
+
});
|
237
|
+
test('MarkdownStyleTildaBlock', () => {
|
238
|
+
const docstring = `Backtick block:
|
237
239
|
|
238
240
|
${tripleTilda}
|
239
241
|
print(foo_bar)
|
@@ -244,7 +246,7 @@ ${tripleTilda}
|
|
244
246
|
|
245
247
|
And some text after.
|
246
248
|
`;
|
247
|
-
|
249
|
+
const markdown = `Backtick block:
|
248
250
|
|
249
251
|
${tripleTilda}
|
250
252
|
print(foo_bar)
|
@@ -255,10 +257,10 @@ ${tripleTilda}
|
|
255
257
|
|
256
258
|
And some text after.
|
257
259
|
`;
|
258
|
-
|
259
|
-
});
|
260
|
-
test('RestLiteralBlock', () => {
|
261
|
-
|
260
|
+
_testConvertToMarkdown(docstring, markdown);
|
261
|
+
});
|
262
|
+
test('RestLiteralBlock', () => {
|
263
|
+
const docstring = `
|
262
264
|
Take a look at this code::
|
263
265
|
|
264
266
|
if foo:
|
@@ -268,7 +270,7 @@ Take a look at this code::
|
|
268
270
|
|
269
271
|
This text comes after.
|
270
272
|
`;
|
271
|
-
|
273
|
+
const markdown = `Take a look at this code:
|
272
274
|
|
273
275
|
${tripleTick}
|
274
276
|
if foo:
|
@@ -279,10 +281,10 @@ ${tripleTick}
|
|
279
281
|
|
280
282
|
This text comes after.
|
281
283
|
`;
|
282
|
-
|
283
|
-
});
|
284
|
-
test('RestLiteralBlockEmptyDoubleColonLine', () => {
|
285
|
-
|
284
|
+
_testConvertToMarkdown(docstring, markdown);
|
285
|
+
});
|
286
|
+
test('RestLiteralBlockEmptyDoubleColonLine', () => {
|
287
|
+
const docstring = `
|
286
288
|
::
|
287
289
|
|
288
290
|
if foo:
|
@@ -290,17 +292,17 @@ test('RestLiteralBlockEmptyDoubleColonLine', () => {
|
|
290
292
|
else:
|
291
293
|
print('not foo!')
|
292
294
|
`;
|
293
|
-
|
295
|
+
const markdown = `${tripleTick}
|
294
296
|
if foo:
|
295
297
|
print(foo)
|
296
298
|
else:
|
297
299
|
print('not foo!')
|
298
300
|
${tripleTick}
|
299
301
|
`;
|
300
|
-
|
301
|
-
});
|
302
|
-
test('RestLiteralBlockExtraSpace', () => {
|
303
|
-
|
302
|
+
_testConvertToMarkdown(docstring, markdown);
|
303
|
+
});
|
304
|
+
test('RestLiteralBlockExtraSpace', () => {
|
305
|
+
const docstring = `
|
304
306
|
Take a look at this code::
|
305
307
|
|
306
308
|
|
@@ -313,7 +315,7 @@ Take a look at this code::
|
|
313
315
|
|
314
316
|
This text comes after.
|
315
317
|
`;
|
316
|
-
|
318
|
+
const markdown = `Take a look at this code:
|
317
319
|
|
318
320
|
${tripleTick}
|
319
321
|
if foo:
|
@@ -324,17 +326,17 @@ ${tripleTick}
|
|
324
326
|
|
325
327
|
This text comes after.
|
326
328
|
`;
|
327
|
-
|
328
|
-
});
|
329
|
-
test('RestLiteralBlockNoIndentOneLiner', () => {
|
330
|
-
|
329
|
+
_testConvertToMarkdown(docstring, markdown);
|
330
|
+
});
|
331
|
+
test('RestLiteralBlockNoIndentOneLiner', () => {
|
332
|
+
const docstring = `
|
331
333
|
The next code is a one-liner::
|
332
334
|
|
333
335
|
print(a + foo + 123)
|
334
336
|
|
335
337
|
And now it's text.
|
336
338
|
`;
|
337
|
-
|
339
|
+
const markdown = `The next code is a one-liner:
|
338
340
|
|
339
341
|
${tripleTick}
|
340
342
|
print(a + foo + 123)
|
@@ -342,10 +344,10 @@ ${tripleTick}
|
|
342
344
|
|
343
345
|
And now it's text.
|
344
346
|
`;
|
345
|
-
|
346
|
-
});
|
347
|
-
test('DirectiveRemoval', () => {
|
348
|
-
|
347
|
+
_testConvertToMarkdown(docstring, markdown);
|
348
|
+
});
|
349
|
+
test('DirectiveRemoval', () => {
|
350
|
+
const docstring = `This is a test.
|
349
351
|
|
350
352
|
.. ignoreme:: example
|
351
353
|
|
@@ -361,22 +363,22 @@ This text is in-between.
|
|
361
363
|
|
362
364
|
This text comes after.
|
363
365
|
`;
|
364
|
-
|
366
|
+
const markdown = `This is a test.
|
365
367
|
|
366
368
|
This text is in-between.
|
367
369
|
|
368
370
|
This text comes after.
|
369
371
|
`;
|
370
|
-
|
371
|
-
});
|
372
|
-
test('ClassDirective', () => {
|
373
|
-
|
372
|
+
_testConvertToMarkdown(docstring, markdown);
|
373
|
+
});
|
374
|
+
test('ClassDirective', () => {
|
375
|
+
const docstring = `
|
374
376
|
.. class:: FooBar()
|
375
377
|
This is a description of ${doubleTick}FooBar${doubleTick}.
|
376
378
|
|
377
379
|
${doubleTick}FooBar${doubleTick} is interesting.
|
378
380
|
`;
|
379
|
-
|
381
|
+
const markdown = `${tripleTick}
|
380
382
|
FooBar()
|
381
383
|
${tripleTick}
|
382
384
|
|
@@ -384,10 +386,10 @@ This is a description of ${singleTick}FooBar${singleTick}.
|
|
384
386
|
|
385
387
|
${singleTick}FooBar${singleTick} is interesting.
|
386
388
|
`;
|
387
|
-
|
388
|
-
});
|
389
|
-
test('CodeBlockDirective', () => {
|
390
|
-
|
389
|
+
_testConvertToMarkdown(docstring, markdown);
|
390
|
+
});
|
391
|
+
test('CodeBlockDirective', () => {
|
392
|
+
const docstring = `Take a look at this
|
391
393
|
.. code-block:: Python
|
392
394
|
|
393
395
|
if foo:
|
@@ -397,7 +399,7 @@ test('CodeBlockDirective', () => {
|
|
397
399
|
|
398
400
|
This text comes after.
|
399
401
|
`;
|
400
|
-
|
402
|
+
const markdown = `Take a look at this
|
401
403
|
${tripleTick}
|
402
404
|
|
403
405
|
if foo:
|
@@ -407,70 +409,70 @@ ${tripleTick}
|
|
407
409
|
${tripleTick}
|
408
410
|
|
409
411
|
This text comes after.`;
|
410
|
-
|
411
|
-
});
|
412
|
-
test('UnfinishedBacktickBlock', () => {
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
});
|
417
|
-
test('UnfinishedTildaBlock', () => {
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
});
|
422
|
-
test('UnfinishedInlineLiteral', () => {
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
});
|
427
|
-
test('DashList', () => {
|
428
|
-
|
412
|
+
_testConvertToMarkdown(docstring, markdown);
|
413
|
+
});
|
414
|
+
test('UnfinishedBacktickBlock', () => {
|
415
|
+
const docstring = '```\nsomething\n';
|
416
|
+
const markdown = '```\nsomething\n```\n';
|
417
|
+
_testConvertToMarkdown(docstring, markdown);
|
418
|
+
});
|
419
|
+
test('UnfinishedTildaBlock', () => {
|
420
|
+
const docstring = '~~~\nsomething\n';
|
421
|
+
const markdown = '~~~\nsomething\n~~~\n';
|
422
|
+
_testConvertToMarkdown(docstring, markdown);
|
423
|
+
});
|
424
|
+
test('UnfinishedInlineLiteral', () => {
|
425
|
+
const docstring = '`oops\n';
|
426
|
+
const markdown = '`oops`';
|
427
|
+
_testConvertToMarkdown(docstring, markdown);
|
428
|
+
});
|
429
|
+
test('DashList', () => {
|
430
|
+
const docstring = `
|
429
431
|
This is a list:
|
430
432
|
- Item 1
|
431
433
|
- Item 2
|
432
434
|
`;
|
433
|
-
|
435
|
+
const markdown = `This is a list:
|
434
436
|
- Item 1
|
435
437
|
- Item 2
|
436
438
|
`;
|
437
|
-
|
438
|
-
});
|
439
|
-
test('AsteriskList', () => {
|
440
|
-
|
439
|
+
_testConvertToMarkdown(docstring, markdown);
|
440
|
+
});
|
441
|
+
test('AsteriskList', () => {
|
442
|
+
const docstring = `
|
441
443
|
This is a list:
|
442
444
|
* Item 1
|
443
445
|
* Item 2
|
444
446
|
`;
|
445
|
-
|
447
|
+
const markdown = `This is a list:
|
446
448
|
* Item 1
|
447
449
|
* Item 2
|
448
450
|
`;
|
449
|
-
|
450
|
-
});
|
451
|
-
test('SquareBrackets', () => {
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
});
|
456
|
-
test('ListDashMultiline', () => {
|
457
|
-
|
451
|
+
_testConvertToMarkdown(docstring, markdown);
|
452
|
+
});
|
453
|
+
test('SquareBrackets', () => {
|
454
|
+
const docstring = 'Optional[List[str]]';
|
455
|
+
const markdown = 'Optional\\[List\\[str\\]\\]';
|
456
|
+
_testConvertToMarkdown(docstring, markdown);
|
457
|
+
});
|
458
|
+
test('ListDashMultiline', () => {
|
459
|
+
const docstring = `Keyword Arguments:
|
458
460
|
|
459
461
|
- option_strings -- A list of command-line option strings which
|
460
462
|
should be associated with this action.
|
461
463
|
|
462
464
|
- dest -- The name of the attribute to hold the created object(s)
|
463
465
|
`;
|
464
|
-
|
466
|
+
const markdown = `Keyword Arguments:
|
465
467
|
|
466
468
|
- option\\_strings -- A list of command-line option strings which
|
467
469
|
should be associated with this action.
|
468
470
|
|
469
471
|
- dest -- The name of the attribute to hold the created object(s)`;
|
470
|
-
|
471
|
-
});
|
472
|
-
test('HalfIndentOnLeadingDash', () => {
|
473
|
-
|
472
|
+
_testConvertToMarkdown(docstring, markdown);
|
473
|
+
});
|
474
|
+
test('HalfIndentOnLeadingDash', () => {
|
475
|
+
const docstring = `Dash List
|
474
476
|
- foo
|
475
477
|
- foo
|
476
478
|
- bar
|
@@ -478,17 +480,17 @@ test('HalfIndentOnLeadingDash', () => {
|
|
478
480
|
- qux
|
479
481
|
- aaa
|
480
482
|
`;
|
481
|
-
|
483
|
+
const markdown = `Dash List
|
482
484
|
- foo
|
483
485
|
- foo
|
484
486
|
- bar
|
485
487
|
- baz
|
486
488
|
- qux
|
487
489
|
- aaa`;
|
488
|
-
|
489
|
-
});
|
490
|
-
test('AsteriskMultilineList', () => {
|
491
|
-
|
490
|
+
_testConvertToMarkdown(docstring, markdown);
|
491
|
+
});
|
492
|
+
test('AsteriskMultilineList', () => {
|
493
|
+
const docstring = `
|
492
494
|
This is a list:
|
493
495
|
* this is a long, multi-line paragraph. It
|
494
496
|
seems to go on and on.
|
@@ -496,30 +498,30 @@ This is a list:
|
|
496
498
|
* this is a long, multi-line paragraph. It
|
497
499
|
seems to go on and on.
|
498
500
|
`;
|
499
|
-
|
501
|
+
const markdown = `This is a list:
|
500
502
|
* this is a long, multi-line paragraph. It
|
501
503
|
seems to go on and on.
|
502
504
|
|
503
505
|
* this is a long, multi-line paragraph. It
|
504
506
|
seems to go on and on.
|
505
507
|
`;
|
506
|
-
|
507
|
-
});
|
508
|
-
test('ListAsteriskAddLeadingSpace', () => {
|
509
|
-
|
508
|
+
_testConvertToMarkdown(docstring, markdown);
|
509
|
+
});
|
510
|
+
test('ListAsteriskAddLeadingSpace', () => {
|
511
|
+
const docstring = `Title
|
510
512
|
* First line bullet, no leading space
|
511
513
|
with second line.
|
512
514
|
* Second line bullet, no leading space
|
513
515
|
with second line.`;
|
514
|
-
|
516
|
+
const markdown = `Title
|
515
517
|
* First line bullet, no leading space
|
516
518
|
with second line.
|
517
519
|
* Second line bullet, no leading space
|
518
520
|
with second line.`;
|
519
|
-
|
520
|
-
});
|
521
|
-
test('PandasReadCsvListIndent', () => {
|
522
|
-
|
521
|
+
_testConvertToMarkdown(docstring, markdown);
|
522
|
+
});
|
523
|
+
test('PandasReadCsvListIndent', () => {
|
524
|
+
const docstring = `Title
|
523
525
|
keep_default_na : bool, default True
|
524
526
|
Whether or not to include the default NaN values when parsing the data.
|
525
527
|
|
@@ -527,7 +529,7 @@ keep_default_na : bool, default True
|
|
527
529
|
is appended to the default NaN values used for parsing.
|
528
530
|
|
529
531
|
na_filter : bool, default True`;
|
530
|
-
|
532
|
+
const markdown = `Title
|
531
533
|
keep\\_default\\_na : bool, default True
|
532
534
|
Whether or not to include the default NaN values when parsing the data.
|
533
535
|
|
@@ -535,52 +537,52 @@ keep\\_default\\_na : bool, default True
|
|
535
537
|
is appended to the default NaN values used for parsing.
|
536
538
|
|
537
539
|
na\\_filter : bool, default True`;
|
538
|
-
|
539
|
-
});
|
540
|
-
test('FieldListEpyText', () => {
|
541
|
-
|
540
|
+
_testConvertToMarkdown(docstring, markdown);
|
541
|
+
});
|
542
|
+
test('FieldListEpyText', () => {
|
543
|
+
const docstring = `
|
542
544
|
1. Epytext:
|
543
545
|
@param param1: description`;
|
544
|
-
|
546
|
+
const markdown = `
|
545
547
|
1. Epytext:
|
546
548
|
@param param1: description`;
|
547
|
-
|
548
|
-
});
|
549
|
-
test('FieldListRest', () => {
|
550
|
-
|
549
|
+
_testConvertToMarkdown(docstring, markdown);
|
550
|
+
});
|
551
|
+
test('FieldListRest', () => {
|
552
|
+
const docstring = `
|
551
553
|
2. reST:
|
552
554
|
:param param1: description`;
|
553
|
-
|
555
|
+
const markdown = `
|
554
556
|
2. reST:
|
555
557
|
:param param1: description`;
|
556
|
-
|
557
|
-
});
|
558
|
-
test('FieldListGoogleV1', () => {
|
559
|
-
|
558
|
+
_testConvertToMarkdown(docstring, markdown);
|
559
|
+
});
|
560
|
+
test('FieldListGoogleV1', () => {
|
561
|
+
const docstring = `
|
560
562
|
3. Google (variant 1):
|
561
563
|
Args:
|
562
564
|
param1: description`;
|
563
|
-
|
565
|
+
const markdown = `
|
564
566
|
3. Google (variant 1):
|
565
567
|
Args:
|
566
568
|
param1: description`;
|
567
|
-
|
568
|
-
});
|
569
|
-
test('FieldListGoogleV2', () => {
|
570
|
-
|
569
|
+
_testConvertToMarkdown(docstring, markdown);
|
570
|
+
});
|
571
|
+
test('FieldListGoogleV2', () => {
|
572
|
+
const docstring = `
|
571
573
|
4. Google (variant 2):
|
572
574
|
Args:
|
573
575
|
param1 (type): description
|
574
576
|
param2 (type): description`;
|
575
|
-
|
577
|
+
const markdown = `
|
576
578
|
4. Google (variant 2):
|
577
579
|
Args:
|
578
580
|
param1 (type): description
|
579
581
|
param2 (type): description`;
|
580
|
-
|
581
|
-
});
|
582
|
-
test('Googlewithreturntypes', () => {
|
583
|
-
|
582
|
+
_testConvertToMarkdown(docstring, markdown);
|
583
|
+
});
|
584
|
+
test('Googlewithreturntypes', () => {
|
585
|
+
const docstring = `
|
584
586
|
Example function with types documented in the docstring.
|
585
587
|
|
586
588
|
\`PEP 484\`_ type annotations are supported. If attribute, parameter, and
|
@@ -596,7 +598,7 @@ test('Googlewithreturntypes', () => {
|
|
596
598
|
|
597
599
|
.. _PEP 484:
|
598
600
|
https://www.python.org/dev/peps/pep-0484/`;
|
599
|
-
|
601
|
+
const markdown = `
|
600
602
|
Example function with types documented in the docstring.
|
601
603
|
|
602
604
|
\`PEP 484\`\\_ type annotations are supported. If attribute, parameter, and
|
@@ -609,10 +611,10 @@ Args:
|
|
609
611
|
|
610
612
|
Returns:
|
611
613
|
bool: The return value. True for success, False otherwise.`;
|
612
|
-
|
613
|
-
});
|
614
|
-
test('GoogleWithComplexTypes', () => {
|
615
|
-
|
614
|
+
_testConvertToMarkdown(docstring, markdown);
|
615
|
+
});
|
616
|
+
test('GoogleWithComplexTypes', () => {
|
617
|
+
const docstring = `
|
616
618
|
Example function with types documented in the docstring.
|
617
619
|
|
618
620
|
Args:
|
@@ -622,7 +624,7 @@ test('GoogleWithComplexTypes', () => {
|
|
622
624
|
Returns:
|
623
625
|
bool: The return value. True for success, False otherwise.
|
624
626
|
`;
|
625
|
-
|
627
|
+
const markdown = `
|
626
628
|
Example function with types documented in the docstring.
|
627
629
|
|
628
630
|
Args:
|
@@ -631,21 +633,21 @@ Args:
|
|
631
633
|
|
632
634
|
Returns:
|
633
635
|
bool: The return value. True for success, False otherwise.`;
|
634
|
-
|
635
|
-
});
|
636
|
-
test('FieldListDontAddLineBreaksToHeaders', () => {
|
637
|
-
|
636
|
+
_testConvertToMarkdown(docstring, markdown);
|
637
|
+
});
|
638
|
+
test('FieldListDontAddLineBreaksToHeaders', () => {
|
639
|
+
const docstring = `
|
638
640
|
Parameters
|
639
641
|
----------
|
640
642
|
ThisIsAFieldAfterAHeader : str`;
|
641
|
-
|
643
|
+
const markdown = `
|
642
644
|
Parameters
|
643
645
|
----------
|
644
646
|
ThisIsAFieldAfterAHeader : str`;
|
645
|
-
|
646
|
-
});
|
647
|
-
test('EpyDocCv2Imread', () => {
|
648
|
-
|
647
|
+
_testConvertToMarkdown(docstring, markdown);
|
648
|
+
});
|
649
|
+
test('EpyDocCv2Imread', () => {
|
650
|
+
const docstring = `imread(filename[, flags]) -> retval
|
649
651
|
. @brief Loads an image from a file.
|
650
652
|
. @anchor imread
|
651
653
|
.
|
@@ -656,7 +658,7 @@ test('EpyDocCv2Imread', () => {
|
|
656
658
|
.
|
657
659
|
. - Windows bitmaps - \\*.bmp, \\*.dib (always supported)
|
658
660
|
. - JPEG files - \\*.jpeg, \\*.jpg, \\*.jpe (see the *Note* section)`;
|
659
|
-
|
661
|
+
const markdown = `imread(filename\\[, flags\\]) -> retval
|
660
662
|
|
661
663
|
@brief Loads an image from a file.
|
662
664
|
|
@@ -669,10 +671,10 @@ Currently, the following file formats are supported:
|
|
669
671
|
|
670
672
|
- Windows bitmaps - \\*.bmp, \\*.dib (always supported)
|
671
673
|
- JPEG files - \\*.jpeg, \\*.jpg, \\*.jpe (see the \\*Note\\* section)`;
|
672
|
-
|
673
|
-
});
|
674
|
-
test('Non EpyDocCv2Imread', () => {
|
675
|
-
|
674
|
+
_testConvertToMarkdown(docstring, markdown);
|
675
|
+
});
|
676
|
+
test('Non EpyDocCv2Imread', () => {
|
677
|
+
const docstring = `imread(filename[, flags]) -> retval
|
676
678
|
. @brief Loads an image from a file.
|
677
679
|
. @anchor imread
|
678
680
|
.
|
@@ -683,7 +685,7 @@ test('Non EpyDocCv2Imread', () => {
|
|
683
685
|
.
|
684
686
|
. - Windows bitmaps - \\*.bmp, \\*.dib (always supported)
|
685
687
|
. - JPEG files - \\*.jpeg, \\*.jpg, \\*.jpe (see the *Note* section)`;
|
686
|
-
|
688
|
+
const markdown = `imread(filename\\[, flags\\]) -> retval
|
687
689
|
. @brief Loads an image from a file.
|
688
690
|
. @anchor imread
|
689
691
|
.
|
@@ -694,10 +696,10 @@ test('Non EpyDocCv2Imread', () => {
|
|
694
696
|
.
|
695
697
|
. - Windows bitmaps - \\*.bmp, \\*.dib (always supported)
|
696
698
|
. - JPEG files - \\*.jpeg, \\*.jpg, \\*.jpe (see the \\*Note\\* section)`;
|
697
|
-
|
698
|
-
});
|
699
|
-
test('EpyDocTest', () => {
|
700
|
-
|
699
|
+
_testConvertToMarkdown(docstring, markdown);
|
700
|
+
});
|
701
|
+
test('EpyDocTest', () => {
|
702
|
+
const docstring = `Return the x intercept of the line M{y=m*x+b}. The X{x intercept}
|
701
703
|
of a line is the point at which it crosses the x axis (M{y=0}).
|
702
704
|
|
703
705
|
This function can be used in conjuction with L{z_transform} to
|
@@ -710,7 +712,7 @@ find an arbitrary function's zeros.
|
|
710
712
|
line is the point at which it crosses the y axis (M{x=0}).
|
711
713
|
@rtype: number
|
712
714
|
@return: the x intercept of the line M{y=m*x+b}.`;
|
713
|
-
|
715
|
+
const markdown = `Return the x intercept of the line M{y=m\\*x+b}. The X{x intercept}
|
714
716
|
of a line is the point at which it crosses the x axis (M{y=0}).
|
715
717
|
|
716
718
|
This function can be used in conjuction with L{z\\_transform} to
|
@@ -728,20 +730,20 @@ find an arbitrary function's zeros.
|
|
728
730
|
@rtype: number
|
729
731
|
|
730
732
|
@return: the x intercept of the line M{y=m\\*x+b}.`;
|
731
|
-
|
732
|
-
});
|
733
|
-
test('DontEscapeHtmlTagsInsideCodeBlocks', () => {
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
});
|
738
|
-
test('EscapeHtmlTagsOutsideCodeBlocks', () => {
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
});
|
743
|
-
test('IndentedCodeBlock', () => {
|
744
|
-
|
733
|
+
_testConvertToMarkdown(docstring, markdown);
|
734
|
+
});
|
735
|
+
test('DontEscapeHtmlTagsInsideCodeBlocks', () => {
|
736
|
+
const docstring = 'hello `<code>`';
|
737
|
+
const markdown = 'hello `<code>`';
|
738
|
+
_testConvertToMarkdown(docstring, markdown);
|
739
|
+
});
|
740
|
+
test('EscapeHtmlTagsOutsideCodeBlocks', () => {
|
741
|
+
const docstring = 'hello <noncode>';
|
742
|
+
const markdown = 'hello <noncode>';
|
743
|
+
_testConvertToMarkdown(docstring, markdown);
|
744
|
+
});
|
745
|
+
test('IndentedCodeBlock', () => {
|
746
|
+
const docstring = `
|
745
747
|
Expected:
|
746
748
|
${tripleTick}python
|
747
749
|
def some_fn():
|
@@ -751,7 +753,7 @@ Expected:
|
|
751
753
|
"""
|
752
754
|
${tripleTick}
|
753
755
|
`;
|
754
|
-
|
756
|
+
const markdown = `
|
755
757
|
Expected:
|
756
758
|
${tripleTick}python
|
757
759
|
def some_fn():
|
@@ -761,10 +763,10 @@ ${tripleTick}python
|
|
761
763
|
"""
|
762
764
|
${tripleTick}
|
763
765
|
`;
|
764
|
-
|
765
|
-
});
|
766
|
-
test('IndentedCodeBlockTilda', () => {
|
767
|
-
|
766
|
+
_testConvertToMarkdown(docstring, markdown);
|
767
|
+
});
|
768
|
+
test('IndentedCodeBlockTilda', () => {
|
769
|
+
const docstring = `
|
768
770
|
Expected:
|
769
771
|
${tripleTilda}python
|
770
772
|
def some_fn():
|
@@ -774,7 +776,7 @@ Expected:
|
|
774
776
|
"""
|
775
777
|
${tripleTilda}
|
776
778
|
`;
|
777
|
-
|
779
|
+
const markdown = `
|
778
780
|
Expected:
|
779
781
|
${tripleTilda}python
|
780
782
|
def some_fn():
|
@@ -784,10 +786,10 @@ ${tripleTilda}python
|
|
784
786
|
"""
|
785
787
|
${tripleTilda}
|
786
788
|
`;
|
787
|
-
|
788
|
-
});
|
789
|
-
test('MixedCodeBlockBacktick', () => {
|
790
|
-
|
789
|
+
_testConvertToMarkdown(docstring, markdown);
|
790
|
+
});
|
791
|
+
test('MixedCodeBlockBacktick', () => {
|
792
|
+
const docstring = `
|
791
793
|
Expected:
|
792
794
|
${tripleTick}python
|
793
795
|
def some_fn():
|
@@ -805,7 +807,7 @@ Expected:
|
|
805
807
|
"""
|
806
808
|
${tripleTilda}
|
807
809
|
`;
|
808
|
-
|
810
|
+
const markdown = `
|
809
811
|
Expected:
|
810
812
|
${tripleTick}python
|
811
813
|
def some_fn():
|
@@ -824,27 +826,27 @@ ${tripleTilda}python
|
|
824
826
|
"""
|
825
827
|
${tripleTilda}
|
826
828
|
`;
|
827
|
-
|
828
|
-
});
|
829
|
-
test('RestTableWithHeader', () => {
|
830
|
-
|
829
|
+
_testConvertToMarkdown(docstring, markdown);
|
830
|
+
});
|
831
|
+
test('RestTableWithHeader', () => {
|
832
|
+
const docstring = `
|
831
833
|
=============== =========================================================
|
832
834
|
Generator
|
833
835
|
--------------- ---------------------------------------------------------
|
834
836
|
Generator Class implementing all of the random number distributions
|
835
837
|
default_rng Default constructor for \`\`Generator\`\`
|
836
838
|
=============== =========================================================`;
|
837
|
-
|
839
|
+
const markdown = `
|
838
840
|
|Generator | |
|
839
841
|
|---------------|---------------------------------------------------------|
|
840
842
|
|Generator |Class implementing all of the random number distributions|
|
841
843
|
|default_rng |Default constructor for \`\`Generator\`\`|
|
842
844
|
|
843
845
|
<br/>`;
|
844
|
-
|
845
|
-
});
|
846
|
-
test('RestTablesMultilineHeader', () => {
|
847
|
-
|
846
|
+
_testConvertToMarkdown(docstring, markdown);
|
847
|
+
});
|
848
|
+
test('RestTablesMultilineHeader', () => {
|
849
|
+
const docstring = `
|
848
850
|
==================== =========================================================
|
849
851
|
Compatibility
|
850
852
|
functions - removed
|
@@ -852,16 +854,16 @@ in the new API
|
|
852
854
|
-------------------- ---------------------------------------------------------
|
853
855
|
rand Uniformly distributed values.
|
854
856
|
==================== =========================================================`;
|
855
|
-
|
857
|
+
const markdown = `
|
856
858
|
|Compatibility <br>functions - removed <br>in the new API | <br> <br> |
|
857
859
|
|--------------------|---------------------------------------------------------|
|
858
860
|
|rand |Uniformly distributed values.|
|
859
861
|
|
860
862
|
<br/>`;
|
861
|
-
|
862
|
-
});
|
863
|
-
test('RestTableSimple', () => {
|
864
|
-
|
863
|
+
_testConvertToMarkdown(docstring, markdown);
|
864
|
+
});
|
865
|
+
test('RestTableSimple', () => {
|
866
|
+
const docstring = `
|
865
867
|
============================== =====================================
|
866
868
|
Scalar Type Array Type
|
867
869
|
============================== =====================================
|
@@ -869,16 +871,16 @@ Scalar Type Array Type
|
|
869
871
|
:class:\`pandas.Period\` :class:\`pandas.arrays.PeriodArray\`
|
870
872
|
============================== =====================================
|
871
873
|
`;
|
872
|
-
|
874
|
+
const markdown = `|Scalar Type |Array Type |
|
873
875
|
|------------------------------|-------------------------------------|
|
874
876
|
|:class:\`pandas.Interval\` |:class:\`pandas.arrays.IntervalArray\`|
|
875
877
|
|:class:\`pandas.Period\` |:class:\`pandas.arrays.PeriodArray\`|
|
876
878
|
|
877
879
|
<br/>`;
|
878
|
-
|
879
|
-
});
|
880
|
-
test('ReSTTableIndented', () => {
|
881
|
-
|
880
|
+
_testConvertToMarkdown(docstring, markdown);
|
881
|
+
});
|
882
|
+
test('ReSTTableIndented', () => {
|
883
|
+
const docstring = `
|
882
884
|
data :
|
883
885
|
|
884
886
|
dtype : str, np.dtype, or ExtensionDtype, optional
|
@@ -889,7 +891,7 @@ test('ReSTTableIndented', () => {
|
|
889
891
|
:class:\`pandas.Interval\` :class:\`pandas.arrays.IntervalArray\`
|
890
892
|
:class:\`pandas.Period\` :class:\`pandas.arrays.PeriodArray\`
|
891
893
|
============================== =====================================`;
|
892
|
-
|
894
|
+
const markdown = `
|
893
895
|
data :
|
894
896
|
|
895
897
|
dtype : str, np.dtype, or ExtensionDtype, optional
|
@@ -900,31 +902,31 @@ dtype : str, np.dtype, or ExtensionDtype, optional
|
|
900
902
|
| :class:\`pandas.Period\` | :class:\`pandas.arrays.PeriodArray\`|
|
901
903
|
|
902
904
|
<br/>`;
|
903
|
-
|
904
|
-
});
|
905
|
-
test(`OddnumberOfColons`, () => {
|
906
|
-
|
905
|
+
_testConvertToMarkdown(docstring, markdown);
|
906
|
+
});
|
907
|
+
test(`OddnumberOfColons`, () => {
|
908
|
+
const docstring = `
|
907
909
|
@param 'original:str' or 'original:list': original string to compare
|
908
910
|
@param 'new:str': the new string to compare
|
909
911
|
@return 'int': levenshtein difference
|
910
912
|
@return 'list': levenshtein difference if list
|
911
913
|
`;
|
912
|
-
|
913
|
-
|
914
|
-
});
|
915
|
-
function _testConvertToMarkdown(docstring, expectedMarkdown) {
|
916
|
-
|
917
|
-
|
918
|
-
}
|
919
|
-
function _testConvertToPlainText(docstring, expectedPlainText) {
|
920
|
-
|
921
|
-
|
922
|
-
}
|
923
|
-
function _normalizeLineEndings(text) {
|
924
|
-
|
925
|
-
}
|
926
|
-
test('RPYCLiteralBlockTransition', () => {
|
927
|
-
|
914
|
+
const markdown = `@param 'original:str' or 'original:list': original string to compare\n\n@param 'new:str': the new string to compare\n\n@return 'int': levenshtein difference\n\n@return 'list': levenshtein difference if list`;
|
915
|
+
_testConvertToMarkdown(docstring, markdown);
|
916
|
+
});
|
917
|
+
function _testConvertToMarkdown(docstring, expectedMarkdown) {
|
918
|
+
const actualMarkdown = docStringService.convertDocStringToMarkdown(docstring);
|
919
|
+
assert.equal(_normalizeLineEndings(actualMarkdown).trim(), _normalizeLineEndings(expectedMarkdown).trim());
|
920
|
+
}
|
921
|
+
function _testConvertToPlainText(docstring, expectedPlainText) {
|
922
|
+
const actualMarkdown = docStringService.convertDocStringToPlainText(docstring);
|
923
|
+
assert.equal(_normalizeLineEndings(actualMarkdown).trim(), _normalizeLineEndings(expectedPlainText).trim());
|
924
|
+
}
|
925
|
+
function _normalizeLineEndings(text) {
|
926
|
+
return text.split(/\r?\n/).join('\n');
|
927
|
+
}
|
928
|
+
test('RPYCLiteralBlockTransition', () => {
|
929
|
+
const docstring = `
|
928
930
|
::
|
929
931
|
|
930
932
|
##### ##### ####
|
@@ -939,7 +941,7 @@ test('RPYCLiteralBlockTransition', () => {
|
|
939
941
|
|
940
942
|
Remote Python Call (RPyC)
|
941
943
|
`;
|
942
|
-
|
944
|
+
const markdown = `
|
943
945
|
|
944
946
|
${tripleTick}
|
945
947
|
##### ##### ####
|
@@ -955,6 +957,11 @@ ${tripleTick}
|
|
955
957
|
|
956
958
|
Remote Python Call (RPyC)
|
957
959
|
`;
|
958
|
-
|
960
|
+
_testConvertToMarkdown(docstring, markdown);
|
961
|
+
});
|
962
|
+
}
|
963
|
+
exports.docStringTests = docStringTests;
|
964
|
+
describe('Doc String Conversion', () => {
|
965
|
+
docStringTests();
|
959
966
|
});
|
960
967
|
//# sourceMappingURL=docStringConversion.test.js.map
|