@zzzen/pyright-internal 1.2.0-dev.20240421 → 1.2.0-dev.20240505
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/analyzerNodeInfo.d.ts +1 -4
- package/dist/analyzer/analyzerNodeInfo.js +1 -11
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/binder.d.ts +0 -2
- package/dist/analyzer/binder.js +42 -66
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +98 -45
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constructors.js +31 -13
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +1 -1
- package/dist/analyzer/dataClasses.js +23 -11
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/deprecatedSymbols.js +2 -4
- package/dist/analyzer/deprecatedSymbols.js.map +1 -1
- package/dist/analyzer/namedTuples.js +0 -8
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +3 -2
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +10 -10
- package/dist/analyzer/parseTreeUtils.d.ts +6 -3
- package/dist/analyzer/parseTreeUtils.js +75 -46
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.js +19 -13
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/protocols.js +32 -13
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/scope.d.ts +14 -7
- package/dist/analyzer/scope.js +28 -17
- package/dist/analyzer/scope.js.map +1 -1
- package/dist/analyzer/scopeUtils.js +3 -3
- package/dist/analyzer/scopeUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +252 -207
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +5 -1
- package/dist/analyzer/typeGuards.js +35 -110
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeUtils.js +6 -8
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +4 -6
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.js +13 -0
- package/dist/analyzer/types.js.map +1 -1
- package/dist/common/console.d.ts +12 -1
- package/dist/common/console.js +22 -3
- package/dist/common/console.js.map +1 -1
- package/dist/common/diagnostic.d.ts +4 -0
- package/dist/common/diagnostic.js +10 -4
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +2 -2
- package/dist/common/envVarUtils.js +1 -2
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +6 -3
- package/dist/common/languageServerInterface.js +11 -0
- package/dist/common/languageServerInterface.js.map +1 -1
- package/dist/common/uri/uri.d.ts +2 -0
- package/dist/common/uri/uri.js +3 -1
- package/dist/common/uri/uri.js.map +1 -1
- package/dist/languageServerBase.d.ts +3 -2
- package/dist/languageServerBase.js +13 -35
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +5 -2
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +12 -8
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +1 -1
- package/dist/languageService/dynamicFeature.d.ts +18 -0
- package/dist/languageService/dynamicFeature.js +54 -0
- package/dist/languageService/dynamicFeature.js.map +1 -0
- package/dist/languageService/fileWatcherDynamicFeature.d.ts +12 -0
- package/dist/languageService/fileWatcherDynamicFeature.js +49 -0
- package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -0
- package/dist/languageService/referencesProvider.js +3 -2
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/localization/package.nls.cs.json +28 -26
- package/dist/localization/package.nls.de.json +28 -26
- package/dist/localization/package.nls.en-us.json +1 -1
- package/dist/localization/package.nls.es.json +27 -25
- package/dist/localization/package.nls.fr.json +28 -26
- package/dist/localization/package.nls.it.json +28 -26
- package/dist/localization/package.nls.ja.json +28 -26
- package/dist/localization/package.nls.ko.json +28 -26
- package/dist/localization/package.nls.pl.json +27 -25
- package/dist/localization/package.nls.pt-br.json +28 -26
- package/dist/localization/package.nls.qps-ploc.json +25 -23
- package/dist/localization/package.nls.ru.json +28 -26
- package/dist/localization/package.nls.tr.json +28 -26
- package/dist/localization/package.nls.zh-cn.json +28 -26
- package/dist/localization/package.nls.zh-tw.json +28 -26
- package/dist/parser/parseNodes.d.ts +2 -2
- package/dist/parser/tokenizer.js +7 -1
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/tests/checker.test.js +8 -0
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/envVarUtils.test.js +20 -0
- package/dist/tests/envVarUtils.test.js.map +1 -1
- package/dist/tests/fourslash/{completions.importDunderNames.fourslash.js → completions.import.dunderNames.fourslash.js} +1 -1
- package/dist/tests/fourslash/completions.import.dunderNames.fourslash.js.map +1 -0
- package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.js → completions.import.duplicates.fourslash.js} +1 -1
- package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.js.map → completions.import.duplicates.fourslash.js.map} +1 -1
- package/dist/tests/fourslash/completions.import.exactMatch.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.import.exactMatch.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.js +14 -0
- package/dist/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.d.ts +1 -0
- package/dist/tests/fourslash/{completions.importInterimFile.fourslash.disabled.js → completions.import.interimFile.fourslash.disabled.js} +1 -1
- package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.js.map +1 -0
- package/dist/tests/fourslash/{completions.importPrivateNoPytyped.fourslash.js → completions.import.privateNoPytyped.fourslash.js} +1 -1
- package/dist/tests/fourslash/completions.import.privateNoPytyped.fourslash.js.map +1 -0
- package/dist/tests/fourslash/{completions.importPytyped.fourslash.js → completions.import.pytyped.fourslash.js} +1 -1
- package/dist/tests/fourslash/completions.import.pytyped.fourslash.js.map +1 -0
- package/dist/tests/fourslash/{completions.importPytypedLocal.fourslash.js → completions.import.pytypedLocal.fourslash.js} +1 -1
- package/dist/tests/fourslash/completions.import.pytypedLocal.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.import.submodule.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/{completions.importSubmodule.fourslash.js → completions.import.submodule.fourslash.js} +1 -1
- package/dist/tests/fourslash/completions.import.submodule.fourslash.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.js +1 -1
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js +2 -1
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/parser.test.js +7 -2
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +60 -480
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +0 -482
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +0 -604
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +5 -423
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +2 -2
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typeEvaluator6.test.d.ts +1 -0
- package/dist/tests/typeEvaluator6.test.js +712 -0
- package/dist/tests/typeEvaluator6.test.js.map +1 -0
- package/dist/tests/typeEvaluator7.test.d.ts +1 -0
- package/dist/tests/typeEvaluator7.test.js +677 -0
- package/dist/tests/typeEvaluator7.test.js.map +1 -0
- package/dist/tests/typeEvaluator8.test.d.ts +1 -0
- package/dist/tests/typeEvaluator8.test.js +660 -0
- package/dist/tests/typeEvaluator8.test.js.map +1 -0
- package/dist/workspaceFactory.d.ts +3 -1
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +1 -1
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +0 -1
- package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +0 -1
- package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +0 -1
- package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +0 -1
- package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +0 -1
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +0 -1
- /package/dist/tests/fourslash/{completions.importDunderNames.fourslash.d.ts → completions.import.dunderNames.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importPrivateNoPytyped.fourslash.d.ts → completions.import.duplicates.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importInterimFile.fourslash.disabled.d.ts → completions.import.exactMatch.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importSubmodule.fourslash.d.ts → completions.import.excludeAlreadyImported.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importPytyped.fourslash.d.ts → completions.import.privateNoPytyped.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importPytypedLocal.fourslash.d.ts → completions.import.pytyped.fourslash.d.ts} +0 -0
- /package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.d.ts → completions.import.pytypedLocal.fourslash.d.ts} +0 -0
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* typeEvaluator8.test.ts
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
* Licensed under the MIT license.
|
|
6
|
+
* Author: Eric Traut
|
|
7
|
+
*
|
|
8
|
+
* Unit tests for pyright type evaluator. Tests are split
|
|
9
|
+
* arbitrarily among multiple files so they can run in parallel.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const assert = __importStar(require("assert"));
|
|
36
|
+
const configOptions_1 = require("../common/configOptions");
|
|
37
|
+
const pythonVersion_1 = require("../common/pythonVersion");
|
|
38
|
+
const uri_1 = require("../common/uri/uri");
|
|
39
|
+
const TestUtils = __importStar(require("./testUtils"));
|
|
40
|
+
test('Import1', () => {
|
|
41
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import1.py']);
|
|
42
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
43
|
+
});
|
|
44
|
+
test('Import2', () => {
|
|
45
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import2.py']);
|
|
46
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
47
|
+
});
|
|
48
|
+
test('Import4', () => {
|
|
49
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import4.py']);
|
|
50
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
51
|
+
});
|
|
52
|
+
test('Import6', () => {
|
|
53
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import6.py']);
|
|
54
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
55
|
+
});
|
|
56
|
+
test('Import7', () => {
|
|
57
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import7.py']);
|
|
58
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
59
|
+
});
|
|
60
|
+
test('Import9', () => {
|
|
61
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import9.py']);
|
|
62
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
63
|
+
});
|
|
64
|
+
test('Import10', () => {
|
|
65
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import10.py']);
|
|
66
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
67
|
+
});
|
|
68
|
+
test('Import11', () => {
|
|
69
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import11.py']);
|
|
70
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
71
|
+
});
|
|
72
|
+
test('Import12', () => {
|
|
73
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
74
|
+
// By default, optional diagnostics are ignored.
|
|
75
|
+
let analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions);
|
|
76
|
+
TestUtils.validateResults(analysisResults, 0, 2);
|
|
77
|
+
// Turn on error.
|
|
78
|
+
configOptions.diagnosticRuleSet.reportWildcardImportFromLibrary = 'error';
|
|
79
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions);
|
|
80
|
+
TestUtils.validateResults(analysisResults, 2, 0);
|
|
81
|
+
// Turn off diagnostic.
|
|
82
|
+
configOptions.diagnosticRuleSet.reportWildcardImportFromLibrary = 'none';
|
|
83
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions);
|
|
84
|
+
TestUtils.validateResults(analysisResults, 0, 0);
|
|
85
|
+
});
|
|
86
|
+
test('Import14', () => {
|
|
87
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import14.py', 'import13.py']);
|
|
88
|
+
assert.strictEqual(analysisResults.length, 2);
|
|
89
|
+
assert.strictEqual(analysisResults[0].errors.length, 0);
|
|
90
|
+
assert.strictEqual(analysisResults[1].errors.length, 0);
|
|
91
|
+
});
|
|
92
|
+
test('Import15', () => {
|
|
93
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import15.py']);
|
|
94
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
95
|
+
});
|
|
96
|
+
test('Import16', () => {
|
|
97
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import16.py']);
|
|
98
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
99
|
+
});
|
|
100
|
+
test('Import18', () => {
|
|
101
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import18.py']);
|
|
102
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
103
|
+
});
|
|
104
|
+
test('DunderAll1', () => {
|
|
105
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
106
|
+
// By default, reportUnsupportedDunderAll is a warning.
|
|
107
|
+
let analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions);
|
|
108
|
+
TestUtils.validateResults(analysisResults, 0, 7);
|
|
109
|
+
// Turn on error.
|
|
110
|
+
configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error';
|
|
111
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions);
|
|
112
|
+
TestUtils.validateResults(analysisResults, 7, 0);
|
|
113
|
+
// Turn off diagnostic.
|
|
114
|
+
configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'none';
|
|
115
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions);
|
|
116
|
+
TestUtils.validateResults(analysisResults, 0, 0);
|
|
117
|
+
});
|
|
118
|
+
test('DunderAll2', () => {
|
|
119
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
120
|
+
// By default, reportUnsupportedDunderAll is a warning.
|
|
121
|
+
let analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions);
|
|
122
|
+
TestUtils.validateResults(analysisResults, 0, 3);
|
|
123
|
+
// Turn on error.
|
|
124
|
+
configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error';
|
|
125
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions);
|
|
126
|
+
TestUtils.validateResults(analysisResults, 3, 0);
|
|
127
|
+
// Turn off diagnostic.
|
|
128
|
+
configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'none';
|
|
129
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions);
|
|
130
|
+
TestUtils.validateResults(analysisResults, 0, 0);
|
|
131
|
+
});
|
|
132
|
+
test('DunderAll3', () => {
|
|
133
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
134
|
+
// Turn on error.
|
|
135
|
+
configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error';
|
|
136
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll3.pyi'], configOptions);
|
|
137
|
+
TestUtils.validateResults(analysisResults, 0, 0);
|
|
138
|
+
});
|
|
139
|
+
test('CodeFlow1', () => {
|
|
140
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow1.py']);
|
|
141
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
142
|
+
});
|
|
143
|
+
test('CodeFlow2', () => {
|
|
144
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow2.py']);
|
|
145
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
146
|
+
});
|
|
147
|
+
test('CodeFlow3', () => {
|
|
148
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow3.py']);
|
|
149
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
150
|
+
});
|
|
151
|
+
test('CodeFlow4', () => {
|
|
152
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow4.py']);
|
|
153
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
154
|
+
});
|
|
155
|
+
test('CodeFlow5', () => {
|
|
156
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow5.py']);
|
|
157
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
158
|
+
});
|
|
159
|
+
test('CodeFlow6', () => {
|
|
160
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow6.py']);
|
|
161
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
162
|
+
});
|
|
163
|
+
test('CodeFlow7', () => {
|
|
164
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow7.py']);
|
|
165
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
166
|
+
});
|
|
167
|
+
test('CodeFlow8', () => {
|
|
168
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow8.py']);
|
|
169
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
170
|
+
});
|
|
171
|
+
test('CapturedVariable1', () => {
|
|
172
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['capturedVariable1.py']);
|
|
173
|
+
TestUtils.validateResults(analysisResults, 6);
|
|
174
|
+
});
|
|
175
|
+
test('CapturedVariable2', () => {
|
|
176
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['capturedVariable2.py']);
|
|
177
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
178
|
+
});
|
|
179
|
+
test('Property1', () => {
|
|
180
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property1.py']);
|
|
181
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
182
|
+
});
|
|
183
|
+
test('Property2', () => {
|
|
184
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property2.py']);
|
|
185
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
186
|
+
});
|
|
187
|
+
test('Property3', () => {
|
|
188
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property3.py']);
|
|
189
|
+
TestUtils.validateResults(analysisResults, 4);
|
|
190
|
+
});
|
|
191
|
+
test('Property4', () => {
|
|
192
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property4.py']);
|
|
193
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
194
|
+
});
|
|
195
|
+
test('Property5', () => {
|
|
196
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property5.py']);
|
|
197
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
198
|
+
});
|
|
199
|
+
test('Property6', () => {
|
|
200
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
201
|
+
// Analyze with reportPropertyTypeMismatch enabled.
|
|
202
|
+
configOptions.diagnosticRuleSet.reportPropertyTypeMismatch = 'error';
|
|
203
|
+
const analysisResult1 = TestUtils.typeAnalyzeSampleFiles(['property6.py'], configOptions);
|
|
204
|
+
TestUtils.validateResults(analysisResult1, 2);
|
|
205
|
+
// Analyze with reportPropertyTypeMismatch disabled.
|
|
206
|
+
configOptions.diagnosticRuleSet.reportPropertyTypeMismatch = 'none';
|
|
207
|
+
const analysisResult2 = TestUtils.typeAnalyzeSampleFiles(['property6.py'], configOptions);
|
|
208
|
+
TestUtils.validateResults(analysisResult2, 0);
|
|
209
|
+
});
|
|
210
|
+
test('Property7', () => {
|
|
211
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property7.py']);
|
|
212
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
213
|
+
});
|
|
214
|
+
test('Property8', () => {
|
|
215
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property8.py']);
|
|
216
|
+
TestUtils.validateResults(analysisResults, 4);
|
|
217
|
+
});
|
|
218
|
+
test('Property9', () => {
|
|
219
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property9.py']);
|
|
220
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
221
|
+
});
|
|
222
|
+
test('Property10', () => {
|
|
223
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property10.py']);
|
|
224
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
225
|
+
});
|
|
226
|
+
test('Property11', () => {
|
|
227
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property11.py']);
|
|
228
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
229
|
+
});
|
|
230
|
+
test('Property12', () => {
|
|
231
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property12.py']);
|
|
232
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
233
|
+
});
|
|
234
|
+
test('Property13', () => {
|
|
235
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property13.py']);
|
|
236
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
237
|
+
});
|
|
238
|
+
test('Property14', () => {
|
|
239
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property14.py']);
|
|
240
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
241
|
+
});
|
|
242
|
+
test('Property15', () => {
|
|
243
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property15.py']);
|
|
244
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
245
|
+
});
|
|
246
|
+
test('Property16', () => {
|
|
247
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property16.py']);
|
|
248
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
249
|
+
});
|
|
250
|
+
test('Property17', () => {
|
|
251
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property17.py']);
|
|
252
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
253
|
+
});
|
|
254
|
+
test('Property18', () => {
|
|
255
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property18.py']);
|
|
256
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
257
|
+
});
|
|
258
|
+
test('Operator1', () => {
|
|
259
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator1.py']);
|
|
260
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
261
|
+
});
|
|
262
|
+
test('Operator2', () => {
|
|
263
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator2.py']);
|
|
264
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
265
|
+
});
|
|
266
|
+
test('Operator3', () => {
|
|
267
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator3.py']);
|
|
268
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
269
|
+
});
|
|
270
|
+
test('Operator4', () => {
|
|
271
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator4.py']);
|
|
272
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
273
|
+
});
|
|
274
|
+
test('Operator5', () => {
|
|
275
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator5.py']);
|
|
276
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
277
|
+
});
|
|
278
|
+
test('Operator6', () => {
|
|
279
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator6.py']);
|
|
280
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
281
|
+
});
|
|
282
|
+
test('Operator7', () => {
|
|
283
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator7.py']);
|
|
284
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
285
|
+
});
|
|
286
|
+
test('Operator8', () => {
|
|
287
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator8.py']);
|
|
288
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
289
|
+
});
|
|
290
|
+
test('Operator9', () => {
|
|
291
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator9.py']);
|
|
292
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
293
|
+
});
|
|
294
|
+
test('Operator10', () => {
|
|
295
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator10.py']);
|
|
296
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
297
|
+
});
|
|
298
|
+
test('Operator11', () => {
|
|
299
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator11.py']);
|
|
300
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
301
|
+
});
|
|
302
|
+
test('Optional1', () => {
|
|
303
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
304
|
+
// Disable diagnostics.
|
|
305
|
+
configOptions.diagnosticRuleSet.reportOptionalSubscript = 'none';
|
|
306
|
+
configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'none';
|
|
307
|
+
configOptions.diagnosticRuleSet.reportOptionalCall = 'none';
|
|
308
|
+
configOptions.diagnosticRuleSet.reportOptionalIterable = 'none';
|
|
309
|
+
configOptions.diagnosticRuleSet.reportOptionalContextManager = 'none';
|
|
310
|
+
configOptions.diagnosticRuleSet.reportOptionalOperand = 'none';
|
|
311
|
+
let analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions);
|
|
312
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
313
|
+
// Turn on warnings.
|
|
314
|
+
configOptions.diagnosticRuleSet.reportOptionalSubscript = 'warning';
|
|
315
|
+
configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'warning';
|
|
316
|
+
configOptions.diagnosticRuleSet.reportOptionalCall = 'warning';
|
|
317
|
+
configOptions.diagnosticRuleSet.reportOptionalIterable = 'warning';
|
|
318
|
+
configOptions.diagnosticRuleSet.reportOptionalContextManager = 'warning';
|
|
319
|
+
configOptions.diagnosticRuleSet.reportOptionalOperand = 'warning';
|
|
320
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions);
|
|
321
|
+
TestUtils.validateResults(analysisResults, 0, 7);
|
|
322
|
+
// Turn on errors.
|
|
323
|
+
configOptions.diagnosticRuleSet.reportOptionalSubscript = 'error';
|
|
324
|
+
configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'error';
|
|
325
|
+
configOptions.diagnosticRuleSet.reportOptionalCall = 'error';
|
|
326
|
+
configOptions.diagnosticRuleSet.reportOptionalIterable = 'error';
|
|
327
|
+
configOptions.diagnosticRuleSet.reportOptionalContextManager = 'error';
|
|
328
|
+
configOptions.diagnosticRuleSet.reportOptionalOperand = 'error';
|
|
329
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions);
|
|
330
|
+
TestUtils.validateResults(analysisResults, 7);
|
|
331
|
+
});
|
|
332
|
+
test('Optional2', () => {
|
|
333
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
334
|
+
// Disable diagnostics.
|
|
335
|
+
configOptions.diagnosticRuleSet.reportOptionalOperand = 'none';
|
|
336
|
+
let analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional2.py'], configOptions);
|
|
337
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
338
|
+
// Turn on errors.
|
|
339
|
+
configOptions.diagnosticRuleSet.reportOptionalOperand = 'error';
|
|
340
|
+
analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional2.py'], configOptions);
|
|
341
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
342
|
+
});
|
|
343
|
+
test('Tuple1', () => {
|
|
344
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple1.py']);
|
|
345
|
+
TestUtils.validateResults(analysisResults, 24);
|
|
346
|
+
});
|
|
347
|
+
test('Tuple2', () => {
|
|
348
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple2.py']);
|
|
349
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
350
|
+
});
|
|
351
|
+
test('Tuple3', () => {
|
|
352
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple3.py']);
|
|
353
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
354
|
+
});
|
|
355
|
+
test('Tuple4', () => {
|
|
356
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple4.py']);
|
|
357
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
358
|
+
});
|
|
359
|
+
test('Tuple5', () => {
|
|
360
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple5.py']);
|
|
361
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
362
|
+
});
|
|
363
|
+
test('Tuple6', () => {
|
|
364
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple6.py']);
|
|
365
|
+
TestUtils.validateResults(analysisResults, 9);
|
|
366
|
+
});
|
|
367
|
+
test('Tuple7', () => {
|
|
368
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple7.py']);
|
|
369
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
370
|
+
});
|
|
371
|
+
test('Tuple8', () => {
|
|
372
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple8.py']);
|
|
373
|
+
TestUtils.validateResults(analysisResults, 11);
|
|
374
|
+
});
|
|
375
|
+
test('Tuple9', () => {
|
|
376
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple9.py']);
|
|
377
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
378
|
+
});
|
|
379
|
+
test('Tuple10', () => {
|
|
380
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple10.py']);
|
|
381
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
382
|
+
});
|
|
383
|
+
test('Tuple11', () => {
|
|
384
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple11.py']);
|
|
385
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
386
|
+
});
|
|
387
|
+
test('Tuple12', () => {
|
|
388
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple12.py']);
|
|
389
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
390
|
+
});
|
|
391
|
+
test('Tuple13', () => {
|
|
392
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple13.py']);
|
|
393
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
394
|
+
});
|
|
395
|
+
test('Tuple15', () => {
|
|
396
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple15.py']);
|
|
397
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
398
|
+
});
|
|
399
|
+
test('Tuple16', () => {
|
|
400
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple16.py']);
|
|
401
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
402
|
+
});
|
|
403
|
+
test('Tuple17', () => {
|
|
404
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple17.py']);
|
|
405
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
406
|
+
});
|
|
407
|
+
test('Tuple18', () => {
|
|
408
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple18.py']);
|
|
409
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
410
|
+
});
|
|
411
|
+
test('NamedTuple1', () => {
|
|
412
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple1.py']);
|
|
413
|
+
TestUtils.validateResults(analysisResults, 13);
|
|
414
|
+
});
|
|
415
|
+
test('NamedTuple2', () => {
|
|
416
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple2.py']);
|
|
417
|
+
TestUtils.validateResults(analysisResults, 8);
|
|
418
|
+
});
|
|
419
|
+
test('NamedTuple3', () => {
|
|
420
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple3.py']);
|
|
421
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
422
|
+
});
|
|
423
|
+
test('NamedTuple4', () => {
|
|
424
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple4.py']);
|
|
425
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
426
|
+
});
|
|
427
|
+
test('NamedTuple5', () => {
|
|
428
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple5.py']);
|
|
429
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
430
|
+
});
|
|
431
|
+
test('NamedTuple6', () => {
|
|
432
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple6.py']);
|
|
433
|
+
TestUtils.validateResults(analysisResults, 6);
|
|
434
|
+
});
|
|
435
|
+
test('NamedTuple7', () => {
|
|
436
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple7.py']);
|
|
437
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
438
|
+
});
|
|
439
|
+
test('NamedTuple8', () => {
|
|
440
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple8.py']);
|
|
441
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
442
|
+
});
|
|
443
|
+
test('NamedTuple9', () => {
|
|
444
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple9.py']);
|
|
445
|
+
TestUtils.validateResults(analysisResults, 3);
|
|
446
|
+
});
|
|
447
|
+
test('NamedTuple10', () => {
|
|
448
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple10.py']);
|
|
449
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
450
|
+
});
|
|
451
|
+
test('Slots1', () => {
|
|
452
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots1.py']);
|
|
453
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
454
|
+
});
|
|
455
|
+
test('Slots2', () => {
|
|
456
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots2.py']);
|
|
457
|
+
TestUtils.validateResults(analysisResults, 3);
|
|
458
|
+
});
|
|
459
|
+
test('Slots3', () => {
|
|
460
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots3.py']);
|
|
461
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
462
|
+
});
|
|
463
|
+
test('Parameters1', () => {
|
|
464
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
465
|
+
configOptions.diagnosticRuleSet.reportMissingParameterType = 'none';
|
|
466
|
+
const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['parameters1.py'], configOptions);
|
|
467
|
+
TestUtils.validateResults(analysisResults1, 0);
|
|
468
|
+
configOptions.diagnosticRuleSet.reportMissingParameterType = 'error';
|
|
469
|
+
const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['parameters1.py'], configOptions);
|
|
470
|
+
TestUtils.validateResults(analysisResults2, 1);
|
|
471
|
+
});
|
|
472
|
+
test('Self1', () => {
|
|
473
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self1.py']);
|
|
474
|
+
TestUtils.validateResults(analysisResults, 15);
|
|
475
|
+
});
|
|
476
|
+
test('Self2', () => {
|
|
477
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self2.py']);
|
|
478
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
479
|
+
});
|
|
480
|
+
test('Self3', () => {
|
|
481
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self3.py']);
|
|
482
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
483
|
+
});
|
|
484
|
+
test('Self4', () => {
|
|
485
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self4.py']);
|
|
486
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
487
|
+
});
|
|
488
|
+
test('Self5', () => {
|
|
489
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self5.py']);
|
|
490
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
491
|
+
});
|
|
492
|
+
test('Self6', () => {
|
|
493
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self6.py']);
|
|
494
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
495
|
+
});
|
|
496
|
+
test('Self7', () => {
|
|
497
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self7.py']);
|
|
498
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
499
|
+
});
|
|
500
|
+
test('Self8', () => {
|
|
501
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self8.py']);
|
|
502
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
503
|
+
});
|
|
504
|
+
test('Self9', () => {
|
|
505
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self9.py']);
|
|
506
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
507
|
+
});
|
|
508
|
+
test('Self10', () => {
|
|
509
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self10.py']);
|
|
510
|
+
TestUtils.validateResults(analysisResults, 2);
|
|
511
|
+
});
|
|
512
|
+
test('UnusedVariable1', () => {
|
|
513
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
514
|
+
configOptions.diagnosticRuleSet.reportUnusedVariable = 'none';
|
|
515
|
+
const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['unusedVariable1.py'], configOptions);
|
|
516
|
+
TestUtils.validateResults(analysisResults1, 0);
|
|
517
|
+
configOptions.diagnosticRuleSet.reportUnusedVariable = 'error';
|
|
518
|
+
const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['unusedVariable1.py'], configOptions);
|
|
519
|
+
TestUtils.validateResults(analysisResults2, 3);
|
|
520
|
+
});
|
|
521
|
+
test('Descriptor1', () => {
|
|
522
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor1.py']);
|
|
523
|
+
TestUtils.validateResults(analysisResults, 6);
|
|
524
|
+
});
|
|
525
|
+
test('Descriptor2', () => {
|
|
526
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor2.py']);
|
|
527
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
528
|
+
});
|
|
529
|
+
test('Descriptor3', () => {
|
|
530
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor3.py']);
|
|
531
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
532
|
+
});
|
|
533
|
+
test('Partial1', () => {
|
|
534
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial1.py']);
|
|
535
|
+
TestUtils.validateResults(analysisResults, 18);
|
|
536
|
+
});
|
|
537
|
+
test('Partial2', () => {
|
|
538
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial2.py']);
|
|
539
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
540
|
+
});
|
|
541
|
+
test('Partial3', () => {
|
|
542
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial3.py']);
|
|
543
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
544
|
+
});
|
|
545
|
+
test('Partial4', () => {
|
|
546
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial4.py']);
|
|
547
|
+
TestUtils.validateResults(analysisResults, 3);
|
|
548
|
+
});
|
|
549
|
+
test('Partial5', () => {
|
|
550
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial5.py']);
|
|
551
|
+
TestUtils.validateResults(analysisResults, 3);
|
|
552
|
+
});
|
|
553
|
+
test('TotalOrdering1', () => {
|
|
554
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['totalOrdering1.py']);
|
|
555
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
556
|
+
});
|
|
557
|
+
test('TupleUnpack1', () => {
|
|
558
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack1.py']);
|
|
559
|
+
TestUtils.validateResults(analysisResults, 5);
|
|
560
|
+
});
|
|
561
|
+
test('TupleUnpack2', () => {
|
|
562
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
563
|
+
configOptions.defaultPythonVersion = pythonVersion_1.pythonVersion3_10;
|
|
564
|
+
const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack2.py'], configOptions);
|
|
565
|
+
TestUtils.validateResults(analysisResults1, 18);
|
|
566
|
+
configOptions.defaultPythonVersion = pythonVersion_1.pythonVersion3_11;
|
|
567
|
+
const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack2.py'], configOptions);
|
|
568
|
+
TestUtils.validateResults(analysisResults2, 4);
|
|
569
|
+
});
|
|
570
|
+
test('TupleUnpack3', () => {
|
|
571
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
572
|
+
configOptions.defaultPythonVersion = pythonVersion_1.pythonVersion3_11;
|
|
573
|
+
const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack3.py'], configOptions);
|
|
574
|
+
TestUtils.validateResults(analysisResults1, 1);
|
|
575
|
+
});
|
|
576
|
+
test('PseudoGeneric1', () => {
|
|
577
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric1.py']);
|
|
578
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
579
|
+
});
|
|
580
|
+
test('PseudoGeneric2', () => {
|
|
581
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric2.py']);
|
|
582
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
583
|
+
});
|
|
584
|
+
test('PseudoGeneric3', () => {
|
|
585
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric3.py']);
|
|
586
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
587
|
+
});
|
|
588
|
+
test('LiteralString1', () => {
|
|
589
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString1.py']);
|
|
590
|
+
TestUtils.validateResults(analysisResults, 10);
|
|
591
|
+
});
|
|
592
|
+
test('LiteralString2', () => {
|
|
593
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString2.py']);
|
|
594
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
595
|
+
});
|
|
596
|
+
test('LiteralString3', () => {
|
|
597
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString3.py']);
|
|
598
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
599
|
+
});
|
|
600
|
+
test('ParamInference1', () => {
|
|
601
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramInference1.py']);
|
|
602
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
603
|
+
});
|
|
604
|
+
test('ParamInference2', () => {
|
|
605
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramInference2.py']);
|
|
606
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
607
|
+
});
|
|
608
|
+
test('Dictionary1', () => {
|
|
609
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary1.py']);
|
|
610
|
+
TestUtils.validateResults(analysisResults, 3);
|
|
611
|
+
});
|
|
612
|
+
test('Dictionary2', () => {
|
|
613
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary2.py']);
|
|
614
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
615
|
+
});
|
|
616
|
+
test('Dictionary3', () => {
|
|
617
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary3.py']);
|
|
618
|
+
TestUtils.validateResults(analysisResults, 1);
|
|
619
|
+
});
|
|
620
|
+
test('Dictionary4', () => {
|
|
621
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary4.py']);
|
|
622
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
623
|
+
});
|
|
624
|
+
test('StaticExpression1', () => {
|
|
625
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.empty());
|
|
626
|
+
configOptions.defaultPythonVersion = pythonVersion_1.pythonVersion3_8;
|
|
627
|
+
configOptions.defaultPythonPlatform = 'windows';
|
|
628
|
+
const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions);
|
|
629
|
+
TestUtils.validateResults(analysisResults1, 9);
|
|
630
|
+
configOptions.defaultPythonVersion = pythonVersion_1.pythonVersion3_11;
|
|
631
|
+
configOptions.defaultPythonPlatform = 'Linux';
|
|
632
|
+
const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions);
|
|
633
|
+
TestUtils.validateResults(analysisResults2, 6);
|
|
634
|
+
configOptions.defineConstant.set('DEFINED_TRUE', true);
|
|
635
|
+
configOptions.defineConstant.set('DEFINED_FALSE', false);
|
|
636
|
+
configOptions.defineConstant.set('DEFINED_STR', 'hi!');
|
|
637
|
+
const analysisResults3 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions);
|
|
638
|
+
TestUtils.validateResults(analysisResults3, 0);
|
|
639
|
+
});
|
|
640
|
+
test('StaticExpression2', () => {
|
|
641
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['staticExpression2.py']);
|
|
642
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
643
|
+
});
|
|
644
|
+
test('SpecialForm1', () => {
|
|
645
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm1.py']);
|
|
646
|
+
TestUtils.validateResults(analysisResults, 4);
|
|
647
|
+
});
|
|
648
|
+
test('SpecialForm2', () => {
|
|
649
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm2.py']);
|
|
650
|
+
TestUtils.validateResults(analysisResults, 0);
|
|
651
|
+
});
|
|
652
|
+
test('SpecialForm3', () => {
|
|
653
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm3.py']);
|
|
654
|
+
TestUtils.validateResults(analysisResults, 22);
|
|
655
|
+
});
|
|
656
|
+
test('SpecialForm4', () => {
|
|
657
|
+
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm4.py']);
|
|
658
|
+
TestUtils.validateResults(analysisResults, 72);
|
|
659
|
+
});
|
|
660
|
+
//# sourceMappingURL=typeEvaluator8.test.js.map
|