From a955a5356fdd9af1bcf6dba0ad549d9c375b73b0 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Fri, 18 Sep 2026 22:50:03 +0800 Subject: [PATCH] =?UTF-8?q?test(vipeye-internal):=20=E6=B8=85=E7=90=86=20P?= =?UTF-8?q?ython=20=E6=97=B6=E4=BB=A3=E6=B5=8B=E8=AF=95=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E5=B9=B6=E4=BF=AE=E5=A4=8D=E9=99=88=E6=97=A7=E6=9C=9F=E6=9C=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 fourslash 夹具(258 个 .py 用例)、fourSlashRunner、hoverProvider、typeEvaluator1-8、checker(共 276 个 pyright Python 语义用例文件) - config/sourceFile: reportPrivateImportUsage 基本默认值期望改为 Viper 的 'none' - config/uri/filesystem/diagnosticOverrides/localizer: 期望改为 .vp/.vpi 扩展、viper.analysis.* 命名空间与 locale 无关断言 - samples: project1/4、venv_auto_detect_*、extended_config 夹具 .py/.pyi 更名为 .vp/.vpi 验证: 相关 32 个套件 343 用例全绿 --- .../vipeye-internal/src/tests/checker.test.ts | 723 ---------- .../vipeye-internal/src/tests/config.test.ts | 22 +- .../src/tests/diagnosticOverrides.test.ts | 2 +- .../src/tests/filesystem.test.ts | 2 +- .../src/tests/fourSlashRunner.test.ts | 36 - ...ons.autoimport.Lib.Found.Type.fourslash.ts | 33 - ...oimport.Lib.Found.duplication.fourslash.ts | 47 - ...tions.autoimport.Lib.NotFound.fourslash.ts | 14 - ...mpletions.autoimport.disabled.fourslash.ts | 25 - ...letions.autoimport.duplicates.fourslash.ts | 36 - .../completions.autoimport.fourslash.ts | 29 - ...letions.autoimport.fromImport.fourslash.ts | 130 -- ...pletions.autoimport.lib.alias.fourslash.ts | 61 - ...pletions.autoimport.plainText.fourslash.ts | 29 - ...completions.autoimport.shadow.fourslash.ts | 48 - ...pletions.autoimport.submodule.fourslash.ts | 31 - ...mpletions.autoimport.topLevel.fourslash.ts | 57 - ...ompletions.autoimport.unicode.fourslash.ts | 30 - ...completions.builtinDocstrings.fourslash.ts | 117 -- .../completions.builtinOverride.fourslash.ts | 22 - ...ompletions.call.stringLiteral.fourslash.ts | 55 - .../completions.call.typedDict.fourslash.ts | 247 ---- ...mpletions.call.typedDict.list.fourslash.ts | 163 --- ...letions.call.typedDict.states.fourslash.ts | 135 -- ...call.unpackedGenericTypedDict.fourslash.ts | 35 - .../completions.classVariable.fourslash.ts | 135 -- .../completions.comment.fourslash.ts | 28 - .../completions.declNames.class.fourslash.ts | 35 - ...mpletions.declNames.exception.fourslash.ts | 18 - .../completions.declNames.for.fourslash.ts | 30 - ...letions.declNames.importAlias.fourslash.ts | 15 - .../completions.declNames.lambda.fourslash.ts | 45 - .../completions.declNames.method.fourslash.ts | 71 - ...ompletions.declNames.overload.fourslash.ts | 156 --- ...ns.declNames.topLevelOverload.fourslash.ts | 141 -- ...tions.dictionary.keys.complex.fourslash.ts | 76 -- ...ns.dictionary.keys.expression.fourslash.ts | 75 - ....dictionary.keys.literalTypes.fourslash.ts | 161 --- ...etions.dictionary.keys.simple.fourslash.ts | 151 -- ...ictionary.keys.stringLiterals.fourslash.ts | 121 -- ...tions.dictionary.keys.symbols.fourslash.ts | 53 - ...letions.dunderNew.Inheritance.fourslash.ts | 30 - .../completions.dunderNew.fourslash.ts | 20 - .../completions.enums.members.fourslash.ts | 44 - .../completions.errorNodes.fourslash.ts | 27 - .../completions.excluded.fourslash.ts | 12 - .../tests/fourslash/completions.fourslash.ts | 51 - .../completions.fstring.fourslash.ts | 33 - ...letions.fstring.stringLiteral.fourslash.ts | 96 -- .../completions.fuzzyMatching.fourslash.ts | 30 - ...ompletions.import.dunderNames.fourslash.ts | 31 - ...completions.import.duplicates.fourslash.ts | 23 - ...completions.import.exactMatch.fourslash.ts | 30 - ...import.excludeAlreadyImported.fourslash.ts | 15 - ...s.import.interimFile.fourslash.disabled.ts | 52 - ...tions.import.privateNoPytyped.fourslash.ts | 32 - .../completions.import.pytyped.fourslash.ts | 32 - ...mpletions.import.pytypedLocal.fourslash.ts | 32 - .../completions.import.submodule.fourslash.ts | 26 - .../fourslash/completions.inList.fourslash.ts | 33 - .../completions.included.fourslash.ts | 12 - ...pletions.indexer.keys.getitem.fourslash.ts | 103 -- ...nherited.function.docFromStub.fourslash.ts | 28 - ...d.overload.docFromScrWithStub.fourslash.ts | 52 - ...nherited.overload.docFromStub.fourslash.ts | 53 - ...inherited.property.docFromSrc.fourslash.ts | 104 -- ...nherited.property.docFromStub.fourslash.ts | 108 -- ...ns.keywords.expressionContext.fourslash.ts | 99 -- ...etions.keywords.pythonVersion.fourslash.ts | 93 -- .../completions.libCodeAndStub.fourslash.ts | 79 -- .../completions.libCodeNoStub.fourslash.ts | 69 - .../completions.libStub.fourslash.ts | 69 - .../completions.literals.fourslash.ts | 33 - .../completions.localCode.fourslash.ts | 74 - ...ntext.UnknownMemberOnInstance.fourslash.ts | 17 - ....UnknownStaticFunctionOnClass.fourslash.ts | 57 - ...s.moduleContext.libCodeNoStub.fourslash.ts | 30 - .../completions.overloads.fourslash.ts | 40 - .../completions.override.default.fourslash.ts | 47 - ...completions.override.default.importStub.ts | 50 - ...ons.override.default.imported.fourslash.ts | 61 - ...letions.override.default.stub.fourslash.ts | 47 - .../completions.override.fourslash.ts | 47 - ...completions.override.property.fourslash.ts | 31 - ...etions.override.property.stub.fourslash.ts | 31 - ...override.staticAndClassmethod.fourslash.ts | 64 - .../completions.override.stub.fourslash.ts | 47 - .../completions.override2.fourslash.ts | 71 - .../completions.parameters.fourslash.ts | 23 - .../fourslash/completions.params.fourslash.ts | 72 - .../completions.parentFolder.fourslash.ts | 17 - .../completions.parentFolders.fourslash.ts | 77 -- .../completions.plainText.fourslash.ts | 34 - .../completions.private.fourslash.ts | 64 - .../completions.property.fourslash.ts | 28 - ...ompletions.propertyDocStrings.fourslash.ts | 64 - .../completions.qualname.fourslash.ts | 35 - .../fourslash/completions.self.fourslash.ts | 43 - ...pletions.stringLiteral.escape.fourslash.ts | 71 - .../completions.stringLiteral.fourslash.ts | 79 -- .../completions.triggers.fourslash.ts | 35 - .../completions.typeAlias.fourslash.ts | 29 - .../completions.typeshed.fourslash.ts | 9 - .../completions.vardecls.fourslash.ts | 41 - ...ompletions.variableDocStrings.fourslash.ts | 82 -- .../completions.wildcardimports.fourslash.ts | 121 -- .../fourslash/completions.with.fourslash.ts | 26 - ...ngModuleSource.compiledModule.fourslash.ts | 133 -- ...agnostics.missingModuleSource.fourslash.ts | 69 - ...gModuleSource.nativeSubmodule.fourslash.ts | 67 - .../findDefinitions.builtinClass.fourslash.ts | 31 - .../findDefinitions.classes.fourslash.ts | 106 -- ...nitions.dataclasses.converter.fourslash.ts | 40 - ...definitionFilter.preferSource.fourslash.ts | 57 - ...definitionFilter.preferSource.onlyStubs.ts | 24 - ...s.definitionFilter.preferStub.fourslash.ts | 29 - ...nFilter.preferStub.onlySource.fourslash.ts | 25 - .../findDefinitions.fields.fourslash.ts | 136 -- .../findDefinitions.functions.fourslash.ts | 92 -- .../findDefinitions.methods.fourslash.ts | 167 --- .../findDefinitions.modules.fourslash.ts | 50 - ...ndDefinitions.namespaceImport.fourslash.ts | 40 - ...tions.namespaceImportWithInit.fourslash.ts | 40 - .../findDefinitions.overloads.fourslash.ts | 223 --- .../findDefinitions.parameters.fourslash.ts | 167 --- ...itions.sourceAndStub.function.fourslash.ts | 26 - ...ions.sourceAndStub.innerClass.fourslash.ts | 32 - ...ourceAndStub.innerClassMethod.fourslash.ts | 33 - ...ions.sourceAndStub.outerClass.fourslash.ts | 28 - ...ourceAndStub.outerClassMethod.fourslash.ts | 29 - ...ub.outerClassPropertyReadOnly.fourslash.ts | 31 - ...b.outerClassPropertyReadWrite.fourslash.ts | 36 - ...dDefinitions.sourceOnly.class.fourslash.ts | 29 - ...initions.sourceOnly.function1.fourslash.ts | 28 - ...initions.sourceOnly.function2.fourslash.ts | 28 - ...ns.sourceOnly.relativeImport1.fourslash.ts | 22 - ...ns.sourceOnly.relativeImport2.fourslash.ts | 22 - .../findDefinitions.stubOnly.fourslash.ts | 61 - .../findDefinitions.stubPackages.fourslash.ts | 71 - ...indDefinitions.typedDict.keys.fourslash.ts | 108 -- .../findDefinitions.variables.fourslash.ts | 93 -- ...ndDefinitions.wildcardimports.fourslash.ts | 122 -- ...dTypeDefinitions.builtinClass.fourslash.ts | 26 - .../findTypeDefinitions.classes.fourslash.ts | 77 -- .../findTypeDefinitions.unions.fourslash.ts | 26 - ...indallreferences.classPropertyReadWrite.ts | 39 - .../fourslash/findallreferences.fourslash.ts | 34 - ...findallreferences.importalias.fourslash.ts | 34 - ...references.invokedFromLibrary.fourslash.ts | 52 - ...ndallreferences.module.nested.fourslash.ts | 67 - ...references.modules.duplicated.fourslash.ts | 59 - .../findallreferences.modules.fourslash.ts | 46 - ...dallreferences.modules.shadow.fourslash.ts | 95 -- .../findallreferences.openFiles.fourslash.ts | 37 - .../findallreferences.parameter.fourslash.ts | 24 - ...eferences.sourceAndStub.class.fourslash.ts | 33 - ...ces.sourceAndStub.classMethod.fourslash.ts | 37 - ...AndStub.classPropertyReadOnly.fourslash.ts | 40 - ...b.classPropertyReadWrite.fourslash.skip.ts | 48 - ...rences.sourceAndStub.function.fourslash.ts | 35 - .../findallreferences.variable.fourslash.ts | 24 - ...ighlightreferences.attributes.fourslash.ts | 31 - .../tests/fourslash/hover.async.fourslash.ts | 11 - ...ngs.builtinInheritedByBuiltin.fourslash.ts | 24 - ...gs.builtinInheritedByUserCode.fourslash.ts | 22 - .../hover.builtinDocstrings.fourslash.ts | 64 - .../hover.class.docString.fourslash.ts | 33 - .../fourslash/hover.classNoInit.fourslash.ts | 14 - .../fourslash/hover.docFromSrc.fourslash.ts | 90 -- ...ver.docFromSrc.pkg-vs-module1.fourslash.ts | 26 - ...ver.docFromSrc.pkg-vs-module2.fourslash.ts | 29 - ...er.docFromSrc.relativeImport1.fourslash.ts | 23 - ...er.docFromSrc.relativeImport2.fourslash.ts | 23 - ...er.docFromSrc.relativeImport3.fourslash.ts | 53 - ...hover.docFromSrc.stringFormat.fourslash.ts | 52 - ...over.docFromSrc.stubs-package.fourslash.ts | 29 - .../hover.docFromSrc.typeshed.fourslash.ts | 20 - .../hover.docstring.alias.fourslash.ts | 40 - .../hover.docstring.links.fourslash.ts | 12 - .../hover.docstring.overloads.fourslash.ts | 41 - .../hover.docstring.parameter.fourslash.ts | 57 - .../hover.docstring.split.fourslash.ts | 35 - .../hover.dunderNew.basic.fourslash.ts | 13 - .../hover.dunderNew.inheritance.fourslash.ts | 16 - .../hover.dunderNew.inheritance2.fourslash.ts | 22 - .../hover.dunderNew.overloads.fourslash.ts | 17 - .../hover.dunderNew.withInit.fourslash.ts | 15 - .../fourslash/hover.formatted.fourslash.ts | 46 - .../src/tests/fourslash/hover.fourslash.ts | 20 - .../hover.import.django.view.fourslash.ts | 27 - .../tests/fourslash/hover.import.fourslash.ts | 11 - .../fourslash/hover.inferred.fourslash.ts | 23 - .../hover.inherited.docFromSrc.fourslash.ts | 63 - ....inherited.docFromSrcWithStub.fourslash.ts | 54 - .../hover.inherited.docFromStub.fourslash.ts | 42 - ...d.overload.docFromSrcWithStub.fourslash.ts | 47 - ...nherited.overload.docFromStub.fourslash.ts | 48 - ...d.property.docFromSrcWithStub.fourslash.ts | 87 -- ...nherited.property.docFromStub.fourslash.ts | 91 -- .../tests/fourslash/hover.init.fourslash.ts | 39 - .../hover.libCodeAndStub.fourslash.ts | 52 - .../hover.libCodeNoStub.fourslash.ts | 41 - .../fourslash/hover.libStub.fourslash.ts | 41 - .../hover.optionalAliasParameter.fourslash.ts | 14 - .../hover.overloadedFunction.fourslash.ts | 23 - .../fourslash/hover.plainText.fourslash.ts | 21 - .../tests/fourslash/hover.slots.fourslash.ts | 15 - .../hover.typedDict.get.fourslash.ts | 15 - .../hover.typedDict.key.fourslash.ts | 51 - .../hover.unpackedTypedDict.key.fourslash.ts | 24 - .../hover.variable.docString.fourslash.ts | 49 - .../hover.wildcardimports.fourslash.ts | 85 -- .../fourslash/import.multipart.fourslash.ts | 21 - .../fourslash/import.multipart2.fourslash.ts | 22 - .../fourslash/import.multipart3.fourslash.ts | 56 - ...rt.multipartModuleClassShadow.fourslash.ts | 47 - .../import.nameconflict.fourslash.ts | 20 - .../import.publicSymbols.fourslash.ts | 65 - .../import.pytyped.dunderAll.fourslash.ts | 77 -- ...import.pytyped.privateSymbols.fourslash.ts | 65 - ...ort.pytyped.typeCheckingBasic.fourslash.ts | 38 - ...mport.pytyped.typeCheckingOff.fourslash.ts | 38 - ....pytyped.unsupportedDunderAll.fourslash.ts | 36 - .../fourslash/import.wildcard.fourslash.ts | 27 - .../fourslash/importnotresolved.fourslash.ts | 13 - ...eSource.disablingInStrictMode.fourslash.ts | 20 - .../missingModuleSource.fourslash.ts | 17 - .../missingTypeStub.codeAction.fourslash.ts | 33 - ...ingTypeStub.command.multipart.fourslash.ts | 48 - ...ngTypeStub.command.singlefile.fourslash.ts | 38 - ...ngTypeStub.command.singlepart.fourslash.ts | 38 - ...peStub.command.trycatchImport.fourslash.ts | 49 - .../fourslash/missingTypeStub.fourslash.ts | 20 - ...singTypeStub.invokeCodeAction.fourslash.ts | 36 - .../src/tests/fourslash/noerrors.fourslash.ts | 9 - .../orderImports1.command.fourslash.ts | 20 - .../orderImports2.command.fourslash.ts | 24 - .../rename.externallyHidden.fourslash.ts | 24 - ...ename.externallyHidden.params.fourslash.ts | 24 - .../src/tests/fourslash/rename.fourslash.ts | 29 - .../rename.function.untitledFile.fourslash.ts | 21 - .../tests/fourslash/rename.init.fourslash.ts | 25 - .../fourslash/rename.library.fourslash.ts | 29 - .../rename.library.sourceAndStub.fourslash.ts | 33 - .../rename.multipleDecl.fourslash.ts | 21 - .../fourslash/rename.parens.fourslash.ts | 20 - .../rename.sourceAndStub.fourslash.ts | 37 - .../rename.string.excluded.fourslash.ts | 43 - .../fourslash/rename.string.fourslash.ts | 26 - .../fourslash/rename.typeParams.fourslash.ts | 29 - ...incomingCalls.aliasedFunction.fourslash.ts | 36 - ...incomingCalls.aliasedVariable.fourslash.ts | 17 - ...rarchy.incomingCalls.function.fourslash.ts | 43 - ...utgoingCalls.aliasedFunction1.fourslash.ts | 57 - ...utgoingCalls.aliasedFunction2.fourslash.ts | 47 - ...rarchy.outgoingCalls.function.fourslash.ts | 41 - .../signature.builtinDocstrings.fourslash.ts | 45 - .../signature.complicated.fourslash.ts | 127 -- .../signature.cornercases.fourslash.ts | 23 - .../signature.dataclassAlias.fourslash.ts | 72 - .../signature.docstrings.fourslash.ts | 43 - ...gnature.docstrings.overloaded.fourslash.ts | 50 - ...re.docstrings.wildcardimports.fourslash.ts | 127 -- .../signature.dunderNew.fourslash.ts | 26 - .../fourslash/signature.overload.fourslash.ts | 64 - .../fourslash/signature.posonly.fourslash.ts | 59 - .../fourslash/signature.simple.fourslash.ts | 120 -- .../src/tests/fourslash/tsconfig.json | 6 - .../tests/fourslash/typeVerifier.fourslash.ts | 50 - .../tests/fourslash/typings/fourslash.d.ts | 459 ------- .../src/tests/hoverProvider.test.ts | 782 ----------- .../src/tests/localizer.test.ts | 6 +- .../project1/{sample1.py => sample1.vp} | 0 .../subfolder1/{sample2.py => sample2.vp} | 0 .../subfolder1-1/{sample3.py => sample3.vp} | 0 .../{presentfile.py => presentfile.vp} | 0 .../{presentfile2.py => presentfile2.vp} | 0 .../{presentfile3.py => presentfile3.vp} | 0 .../tests/samples/project4/viperconfig.json | 6 +- .../sub3/stubs/{sample.pyi => sample.vpi} | 0 .../{test.py => test.vp} | 0 .../{library1.py => library1.vp} | 0 .../{sample1.py => sample1.vp} | 0 .../subfolder1/{sample2.py => sample2.vp} | 0 .../subfolder1-1/{sample3.py => sample3.vp} | 0 .../excluded/{excluded1.py => excluded1.vp} | 0 .../{library1.py => library1.vp} | 0 .../{sample1.py => sample1.vp} | 0 .../subfolder1/{sample2.py => sample2.vp} | 0 .../subfolder1-1/{sample3.py => sample3.vp} | 0 .../src/tests/sourceFile.test.ts | 17 +- .../src/tests/typeEvaluator1.test.ts | 1211 ----------------- .../src/tests/typeEvaluator2.test.ts | 1015 -------------- .../src/tests/typeEvaluator3.test.ts | 1125 --------------- .../src/tests/typeEvaluator4.test.ts | 940 ------------- .../src/tests/typeEvaluator5.test.ts | 439 ------ .../src/tests/typeEvaluator6.test.ts | 1057 -------------- .../src/tests/typeEvaluator7.test.ts | 1054 -------------- .../src/tests/typeEvaluator8.test.ts | 1106 --------------- .../vipeye-internal/src/tests/uri.test.ts | 16 +- 300 files changed, 38 insertions(+), 23110 deletions(-) delete mode 100644 packages/vipeye-internal/src/tests/checker.test.ts delete mode 100644 packages/vipeye-internal/src/tests/fourSlashRunner.test.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.disabled.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.duplicates.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fromImport.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.lib.alias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.plainText.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.shadow.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.submodule.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.topLevel.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.autoimport.unicode.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.builtinDocstrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.builtinOverride.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.call.stringLiteral.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.list.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.states.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.call.unpackedGenericTypedDict.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.classVariable.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.comment.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.class.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.exception.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.for.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.importAlias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.lambda.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.method.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.overload.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.declNames.topLevelOverload.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.complex.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.expression.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.simple.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.symbols.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.Inheritance.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.enums.members.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.errorNodes.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.excluded.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.fstring.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.fstring.stringLiteral.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.fuzzyMatching.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.dunderNames.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.duplicates.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.exactMatch.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.interimFile.fourslash.disabled.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.privateNoPytyped.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.pytyped.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.pytypedLocal.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.import.submodule.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inList.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.included.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.indexer.keys.getitem.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inherited.function.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.keywords.expressionContext.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.keywords.pythonVersion.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.libCodeAndStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.libCodeNoStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.libStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.literals.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.localCode.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.overloads.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.default.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.default.importStub.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.default.imported.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.default.stub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.property.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.property.stub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.staticAndClassmethod.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override.stub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.override2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.parameters.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.params.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.parentFolder.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.parentFolders.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.plainText.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.private.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.property.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.propertyDocStrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.qualname.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.self.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.escape.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.triggers.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.typeAlias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.typeshed.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.vardecls.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.variableDocStrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.wildcardimports.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/completions.with.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.compiledModule.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.nativeSubmodule.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.builtinClass.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.classes.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.dataclasses.converter.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.fields.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.functions.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.methods.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.modules.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImport.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.overloads.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.parameters.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubOnly.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubPackages.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.typedDict.keys.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.variables.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findDefinitions.wildcardimports.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.classes.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.unions.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.classPropertyReadWrite.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.importalias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.module.nested.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.duplicated.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.shadow.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.openFiles.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.parameter.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/findallreferences.variable.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/highlightreferences.attributes.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.async.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.class.docString.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.classNoInit.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.typeshed.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docstring.alias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docstring.links.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docstring.overloads.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docstring.parameter.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.docstring.split.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.basic.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.overloads.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.withInit.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.formatted.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.import.django.view.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.import.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inferred.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrc.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.init.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.libCodeAndStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.libCodeNoStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.libStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.optionalAliasParameter.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.overloadedFunction.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.plainText.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.slots.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.typedDict.get.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.typedDict.key.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.unpackedTypedDict.key.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.variable.docString.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/hover.wildcardimports.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.multipart.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.multipart2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.multipart3.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.multipartModuleClassShadow.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.nameconflict.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.publicSymbols.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.pytyped.dunderAll.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.pytyped.privateSymbols.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.pytyped.unsupportedDunderAll.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/import.wildcard.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/importnotresolved.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingModuleSource.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.codeAction.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.multipart.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlefile.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlepart.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/noerrors.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/orderImports1.command.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/orderImports2.command.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.params.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.function.untitledFile.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.init.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.library.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.library.sourceAndStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.multipleDecl.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.parens.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.sourceAndStub.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.string.excluded.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.string.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/rename.typeParams.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.builtinDocstrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.complicated.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.cornercases.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.dataclassAlias.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.docstrings.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.docstrings.overloaded.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.docstrings.wildcardimports.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.dunderNew.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.overload.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.posonly.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/signature.simple.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/tsconfig.json delete mode 100644 packages/vipeye-internal/src/tests/fourslash/typeVerifier.fourslash.ts delete mode 100644 packages/vipeye-internal/src/tests/fourslash/typings/fourslash.d.ts delete mode 100644 packages/vipeye-internal/src/tests/hoverProvider.test.ts rename packages/vipeye-internal/src/tests/samples/project1/{sample1.py => sample1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project1/subfolder1/{sample2.py => sample2.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project1/subfolder1/subfolder1-1/{sample3.py => sample3.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project4/{presentfile.py => presentfile.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project4/subfolder/{presentfile2.py => presentfile2.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project4/subfolder/{presentfile3.py => presentfile3.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_extended_config/sub3/stubs/{sample.pyi => sample.vpi} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_extended_config/{test.py => test.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/myvenv/Lib/site-packages/{library1.py => library1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/{sample1.py => sample1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/{sample2.py => sample2.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/subfolder1-1/{sample3.py => sample3.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/excluded/{excluded1.py => excluded1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/myvenv/Lib/site-packages/{library1.py => library1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/{sample1.py => sample1.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/{sample2.py => sample2.vp} (100%) rename packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/subfolder1-1/{sample3.py => sample3.vp} (100%) delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator1.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator2.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator3.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator4.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator5.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator6.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator7.test.ts delete mode 100644 packages/vipeye-internal/src/tests/typeEvaluator8.test.ts diff --git a/packages/vipeye-internal/src/tests/checker.test.ts b/packages/vipeye-internal/src/tests/checker.test.ts deleted file mode 100644 index b7bcdd9f..00000000 --- a/packages/vipeye-internal/src/tests/checker.test.ts +++ /dev/null @@ -1,723 +0,0 @@ -/* - * checker.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type checker. These tests also - * exercise the type evaluator (which the checker relies - * heavily upon). - */ - -import { ConfigOptions } from '../common/configOptions'; -import { pythonVersion3_10, pythonVersion3_8, pythonVersion3_9 } from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('BadToken1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['badToken1.py']); - - // We include this in the checker test rather than the tokenizer or - // parser test suite because it has cascading effects that potentially - // affect the type checker logic. - TestUtils.validateResults(analysisResults, 1); -}); - -test('Unicode1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unicode1.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('CircularBaseClass', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['circularBaseClass.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Private1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, optional diagnostics are ignored. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['private1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportPrivateUsage = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['private1.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('Private2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportPrivateUsage = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['private4.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Private3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportPrivateUsage = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['private6.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constant1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, optional diagnostics are ignored. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['constant1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportConstantRedefinition = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['constant1.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('AbstractClass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('AbstractClass2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('AbstractClass3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('AbstractClass4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass4.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('AbstractClass5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass5.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('AbstractClass6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('AbstractClass7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('AbstractClass8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('AbstractClass9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('AbstractClass10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass10.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('AbstractClass11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['abstractClass11.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Constants1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constants1.py']); - - TestUtils.validateResults(analysisResults, 20); -}); - -test('NoReturn1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['noreturn1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('NoReturn2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['noreturn2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NoReturn3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['noreturn3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NoReturn4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['noreturn4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('With1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('With2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('With3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('With4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['with4.py'], configOptions); - TestUtils.validateResults(analysisResults1, 4); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['with4.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0); -}); - -test('With5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('With6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('With7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['with7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Mro1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['mro1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Mro2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['mro2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Mro3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['mro3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Mro4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['mro4.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DefaultInitializer1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, the reportCallInDefaultInitializer is disabled. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['defaultInitializer1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportCallInDefaultInitializer = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['defaultInitializer1.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('UnnecessaryIsInstance1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsInstance1.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportUnnecessaryIsInstance = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsInstance1.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('UnnecessaryIsInstance2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsInstance2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportUnnecessaryIsInstance = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsInstance2.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('UnnecessaryIsSubclass1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsSubclass1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportUnnecessaryIsInstance = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryIsSubclass1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('UnnecessaryCast1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryCast1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportUnnecessaryCast = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryCast1.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('UnnecessaryContains1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryContains1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportUnnecessaryContains = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unnecessaryContains1.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('TypeIgnore1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Disable type ignore - configOptions.diagnosticRuleSet.enableTypeIgnoreComments = false; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore1.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeIgnore2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Disable type ignore - configOptions.diagnosticRuleSet.enableTypeIgnoreComments = false; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore2.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeIgnore3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore3.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Disable type ignore - configOptions.diagnosticRuleSet.enableTypeIgnoreComments = false; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore3.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeIgnore4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore4.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportUnnecessaryTypeIgnoreComment = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore4.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeIgnore5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportUnnecessaryTypeIgnoreComment = 'warning'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIgnore5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 1); -}); - -test('ViperIgnore1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['viperIgnore1.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('ViperIgnore2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['viperIgnore2.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); - - configOptions.diagnosticRuleSet.reportUnnecessaryTypeIgnoreComment = 'warning'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['viperIgnore2.py'], configOptions); - TestUtils.validateResults(analysisResults, 2, 3); -}); - -test('ViperComment1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['viperComment1.py'], configOptions); - TestUtils.validateResults(analysisResults, 9); -}); - -test('DuplicateImports1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, optional diagnostics are ignored. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['duplicateImports1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportDuplicateImport = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['duplicateImports1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('ParamNames1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramNames1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 11); - - configOptions.diagnosticRuleSet.reportSelfClsParameterName = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramNames1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); - - configOptions.diagnosticRuleSet.reportSelfClsParameterName = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramNames1.py'], configOptions); - TestUtils.validateResults(analysisResults, 11, 0); -}); - -test('ParamType1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramType1.py']); - TestUtils.validateResults(analysisResults, 9); -}); - -test('Python2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['python2.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('InconsistentSpaceTab1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['inconsistentSpaceTab1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('InconsistentSpaceTab2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['inconsistentSpaceTab2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DuplicateDeclaration1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['duplicateDeclaration1.py']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('DuplicateDeclaration2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['duplicateDeclaration2.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Strings1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['strings1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportImplicitStringConcatenation = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['strings1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('UnusedExpression1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, this is a warning. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 14); - - // Disable it. - configOptions.diagnosticRuleSet.reportUnusedExpression = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUnusedExpression = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults, 14); -}); - -test('UnusedImport1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Enabled it - configOptions.diagnosticRuleSet.reportUnusedImport = 'warning'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedImport1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 2); - - // Disable it. - configOptions.diagnosticRuleSet.reportUnusedImport = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedImport1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUnusedImport = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedImport1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('UnusedImport2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Disable it. - configOptions.diagnosticRuleSet.reportUnusedImport = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedImport2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUnusedImport = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedImport2.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('UninitializedVariable1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, this is off. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['uninitializedVariable1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUninitializedInstanceVariable = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['uninitializedVariable1.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('UninitializedVariable2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, this is off. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['uninitializedVariable2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUninitializedInstanceVariable = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['uninitializedVariable2.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('UninitializedVariable3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['uninitializedVariable3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('DeprecatedAlias1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults3 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults3, 0, 0, 0, undefined, undefined, 0); - - // Now enable the deprecateTypingAliases setting. - configOptions.diagnosticRuleSet.deprecateTypingAliases = true; - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults4 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults4, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults5 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults5, 0, 0, 0, undefined, undefined, 45); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults6 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults6, 0, 0, 0, undefined, undefined, 49); - - // Now change reportDeprecated to emit an error. - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults7 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults7, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults8 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults8, 45, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults9 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias1.py'], configOptions); - TestUtils.validateResults(analysisResults9, 49, 0, 0, undefined, undefined, 0); -}); - -test('DeprecatedAlias2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults3 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults3, 0, 0, 0, undefined, undefined, 0); - - // Now enable the deprecateTypingAliases setting. - configOptions.diagnosticRuleSet.deprecateTypingAliases = true; - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults4 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults4, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults5 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults5, 0, 0, 0, undefined, undefined, 42); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults6 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults6, 0, 0, 0, undefined, undefined, 46); - - // Now change reportDeprecated to emit an error. - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults7 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults7, 0, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults8 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults8, 42, 0, 0, undefined, undefined, 0); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults9 = TestUtils.typeAnalyzeSampleFiles(['deprecatedAlias2.py'], configOptions); - TestUtils.validateResults(analysisResults9, 46, 0, 0, undefined, undefined, 0); -}); - -test('Deprecated2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 14); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 14); -}); - -test('Deprecated3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated3.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 5); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated3.py'], configOptions); - TestUtils.validateResults(analysisResults2, 5); -}); - -test('Deprecated4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated4.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 7); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated4.py'], configOptions); - TestUtils.validateResults(analysisResults2, 7); -}); - -test('Deprecated5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated5.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 2); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated5.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('Deprecated6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated6.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 3); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated6.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('Deprecated7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated7.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 2); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated7.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('Deprecated8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['deprecated8.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 4); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['deprecated8.py'], configOptions); - TestUtils.validateResults(analysisResults2, 4); -}); diff --git a/packages/vipeye-internal/src/tests/config.test.ts b/packages/vipeye-internal/src/tests/config.test.ts index ce6837ed..f6e70862 100644 --- a/packages/vipeye-internal/src/tests/config.test.ts +++ b/packages/vipeye-internal/src/tests/config.test.ts @@ -55,7 +55,7 @@ describe(`config test'}`, () => { const fileList = service.test_getFileNamesFromFileSpecs(); // The config file specifies a subdirectory, so we should find - // only two of the three "*.py" files present in the project + // only two of the three "*.vp" files present in the project // directory. assert.strictEqual(fileList.length, 2); }); @@ -72,10 +72,10 @@ describe(`config test'}`, () => { // The myVenv directory is detected as a venv and will be automatically excluded const fileList = service.test_getFileNamesFromFileSpecs(); - // There are 3 python files in the workspace, outside of myVenv - // There is 1 python file in myVenv, which should be excluded + // There are 3 Viper files in the workspace, outside of myVenv + // There is 1 Viper file in myVenv, which should be excluded const fileNames = fileList.map((p) => p.fileName).sort(); - assert.deepStrictEqual(fileNames, ['sample1.py', 'sample2.py', 'sample3.py']); + assert.deepStrictEqual(fileNames, ['sample1.vp', 'sample2.vp', 'sample3.vp']); }); test('FindFilesVirtualEnvAutoDetectInclude', () => { @@ -89,11 +89,11 @@ describe(`config test'}`, () => { // Config file defines 'exclude' folder so virtual env will be included const fileList = service.test_getFileNamesFromFileSpecs(); - // There are 3 python files in the workspace, outside of myVenv - // There is 1 more python file in excluded folder - // There is 1 python file in myVenv, which should be included + // There are 3 Viper files in the workspace, outside of myVenv + // There is 1 more Viper file in excluded folder + // There is 1 Viper file in myVenv, which should be included const fileNames = fileList.map((p) => p.fileName).sort(); - assert.deepStrictEqual(fileNames, ['library1.py', 'sample1.py', 'sample2.py', 'sample3.py']); + assert.deepStrictEqual(fileNames, ['library1.vp', 'sample1.vp', 'sample2.vp', 'sample3.vp']); }); test('FileSpecNotAnArray', () => { @@ -416,7 +416,7 @@ describe(`config test'}`, () => { const fileList = service.test_getFileNamesFromFileSpecs(); const fileNames = fileList.map((p) => p.fileName).sort(); - assert.deepStrictEqual(fileNames, ['sample.pyi', 'test.py']); + assert.deepStrictEqual(fileNames, ['sample.vpi', 'test.vp']); const configOptions = service.test_getConfigOptions(commandLineOptions); assert.equal(configOptions.diagnosticRuleSet.strictListInference, true); @@ -771,9 +771,9 @@ describe(`config test'}`, () => { const configWithoutOverride = service.test_getConfigOptions(commandLineOptions); assert.equal(configWithoutOverride.diagnosticRuleSet.reportPrivateImportUsage, 'none'); - // The basic default would be 'error', verify our config overrides it. + // Viper 模式默认关闭 reportPrivateImportUsage(无 PEP 561 / py.typed 私有导入概念)。 const basicDefaults = getBasicDiagnosticRuleSet(); - assert.equal(basicDefaults.reportPrivateImportUsage, 'error'); + assert.equal(basicDefaults.reportPrivateImportUsage, 'none'); // Now simulate positional args overriding include (like `viper --project config.json subdir`). const commandLineOptionsWithOverride = new CommandLineOptions(cwd, /* fromLanguageServer */ false); diff --git a/packages/vipeye-internal/src/tests/diagnosticOverrides.test.ts b/packages/vipeye-internal/src/tests/diagnosticOverrides.test.ts index f0dceb4e..5fcd1638 100644 --- a/packages/vipeye-internal/src/tests/diagnosticOverrides.test.ts +++ b/packages/vipeye-internal/src/tests/diagnosticOverrides.test.ts @@ -68,7 +68,7 @@ describe('Diagnostic overrides', () => { const json = JSON.parse(jsonString); expect(json.contributes?.configuration?.properties).toBeDefined(); - const overrides = json.contributes?.configuration?.properties['python.analysis.diagnosticSeverityOverrides']; + const overrides = json.contributes?.configuration?.properties['viper.analysis.diagnosticSeverityOverrides']; expect(overrides).toBeDefined(); const props = overrides.properties; expect(props).toBeDefined(); diff --git a/packages/vipeye-internal/src/tests/filesystem.test.ts b/packages/vipeye-internal/src/tests/filesystem.test.ts index fc61fa61..f622eda7 100644 --- a/packages/vipeye-internal/src/tests/filesystem.test.ts +++ b/packages/vipeye-internal/src/tests/filesystem.test.ts @@ -243,7 +243,7 @@ test('Mounted directory traversal is lazy for statSync', () => { fs.mountSync(sourceRoot, normalizeSlashes('/mnt'), resolver); // Path traversal to a single child should not force a full directory enumeration. - const stats = fs.statSync(UriEx.file(normalizeSlashes('/mnt/a.pyi'))); + const stats = fs.statSync(UriEx.file(normalizeSlashes('/mnt/a.vpi'))); assert(stats.isFile()); assert.equal(calls.readdirSync, 0); assert.equal(calls.statSync, 1); diff --git a/packages/vipeye-internal/src/tests/fourSlashRunner.test.ts b/packages/vipeye-internal/src/tests/fourSlashRunner.test.ts deleted file mode 100644 index 72b087af..00000000 --- a/packages/vipeye-internal/src/tests/fourSlashRunner.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * fourSlashRunner.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * - * Entry point that will read all *.fourslash.ts files and - * register jest tests for them and run - */ - -import * as path from 'path'; - -import { normalizeSlashes } from '../common/pathUtils'; -import { runFourSlashTest } from './harness/fourslash/runner'; -import * as host from './harness/testHost'; -import { MODULE_PATH } from './harness/vfs/filesystem'; - -describe('fourslash tests', () => { - const testFiles: string[] = []; - - const basePath = path.resolve(path.dirname(module.filename), 'fourslash/'); - for (const file of host.HOST.listFiles(basePath, /.*\.fourslash\.ts$/i, { recursive: true })) { - testFiles.push(file); - } - - testFiles.forEach((file) => { - describe(file, () => { - const fn = normalizeSlashes(file); - const justName = fn.replace(/^.*[\\/]/, ''); - - // TODO: make these to use promise/async rather than callback token - it('fourslash test ' + justName + ' run', (cb) => { - runFourSlashTest(MODULE_PATH, fn, cb, { enablePartialStub: true }); - }); - }); - }); -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.ts deleted file mode 100644 index 157f6238..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|Test/*marker*/|] - -// @filename: test2.py -//// import testLib - -// @filename: testLib/__init__.pyi -// @library: true -//// class Test: -//// pass - -{ - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'Test', - kind: Consts.CompletionItemKind.Class, - documentation: '```\nfrom testLib import Test\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'Test' }, - additionalTextEdits: [{ range: importRange, newText: 'from testLib import Test\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.ts deleted file mode 100644 index c202bea1..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|test/*marker*/|] - -// @filename: test2.py -//// import testLib -//// import testLib.test1 -//// import testLib.test2 -//// a = testLib.test1.Test1() -//// b = testLib.test2.Test2() - -// @filename: testLib/__init__.pyi -// @library: true -//// class Test: -//// pass - -// @filename: testLib/test1.pyi -// @library: true -//// class Test1: -//// pass - -// @filename: testLib/test2.pyi -// @library: true -//// class Test2: -//// pass - -{ - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'test1', - kind: Consts.CompletionItemKind.Module, - documentation: '```\nfrom testLib import test1\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'test1' }, - additionalTextEdits: [{ range: importRange, newText: 'from testLib import test1\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.ts deleted file mode 100644 index 317c3f62..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @filename: test1.py -//// Test[|/*marker*/|] - -// @filename: testLib/__init__.pyi -// @library: true -//// class Test: -//// pass - -// @ts-ignore -await helper.verifyCompletion('excluded', 'markdown', { - marker: { completions: [{ label: 'Test', kind: undefined }] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.disabled.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.disabled.fourslash.ts deleted file mode 100644 index 266fdffc..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.disabled.fourslash.ts +++ /dev/null @@ -1,25 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "autoImportCompletions": false -//// } - -// @filename: test1.py -//// Test[|/*marker*/|] - -// @filename: test2.py -//// class Test: -//// pass - -// @ts-ignore -await helper.verifyCompletion('excluded', 'markdown', { - marker: { - completions: [ - { - label: 'Test', - kind: Consts.CompletionItemKind.Class, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.duplicates.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.duplicates.fourslash.ts deleted file mode 100644 index e1b326df..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.duplicates.fourslash.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// -// @indexer: true - -// @filename: test1.py -//// import math -//// import testLib -//// [|ata/*marker*/|] - -// @filename: testLib/__init__.pyi -// @library: true -//// def atan(x: float) -> float: ... -{ - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'atan', - kind: Consts.CompletionItemKind.Function, - documentation: '```\nfrom math import atan\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'math.atan' }, - }, - { - label: 'atan', - kind: Consts.CompletionItemKind.Function, - documentation: '```\nfrom testLib import atan\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'testLib.atan' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fourslash.ts deleted file mode 100644 index c7a73efd..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|Test/*marker*/|] - -// @filename: test2.py -//// class Test: -//// pass - -{ - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'Test', - kind: Consts.CompletionItemKind.Class, - documentation: '```\nfrom test2 import Test\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'Test' }, - additionalTextEdits: [{ range: importRange, newText: 'from test2 import Test\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fromImport.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fromImport.fourslash.ts deleted file mode 100644 index ca7d44d0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.fromImport.fourslash.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// - -// @filename: test.py -//// from lib import ( -//// [|/*import1*/|]MY_CONST_VAR[|/*import2*/|], -//// ClsOther[|/*import3*/|], -//// my_afunc[|/*import4*/|], -//// ) -//// -//// [|A_CONST/*marker1*/|] -//// [|MY_CONST_VAR2/*marker2*/|] -//// [|Cls/*marker3*/|] -//// [|ClsList/*marker4*/|] -//// [|my_func/*marker5*/|] -//// [|MYA_CONST_VAR/*marker6*/|] -//// [|MY_CONSTA_VAR/*marker7*/|] - -// @filename: lib.py -//// A_CONST = 1 -//// MY_CONST_VAR = 2 -//// MY_CONST_VAR2 = 3 -//// MY_CONSTA_VAR = 4 -//// MYA_CONST_VAR = 4 -//// class Cls: ... -//// class ClsOther: ... -//// ClsOtherList = list[ClsOther] -//// def my_afunc(): ... -//// def my_func(): ... - -{ - const import1Range = helper.getPositionRange('import1'); - const import2Range = helper.getPositionRange('import2'); - const import3Range = helper.getPositionRange('import3'); - const import4Range = helper.getPositionRange('import4'); - const marker1Range = helper.getPositionRange('marker1'); - const marker2Range = helper.getPositionRange('marker2'); - const marker3Range = helper.getPositionRange('marker3'); - const marker4Range = helper.getPositionRange('marker4'); - const marker5Range = helper.getPositionRange('marker5'); - const marker6Range = helper.getPositionRange('marker6'); - const marker7Range = helper.getPositionRange('marker7'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'A_CONST', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import A_CONST\n```', - detail: 'Auto-import', - textEdit: { range: marker1Range, newText: 'A_CONST' }, - additionalTextEdits: [{ range: import1Range, newText: 'A_CONST,\n ' }], - }, - ], - }, - marker2: { - completions: [ - { - label: 'MY_CONST_VAR2', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import MY_CONST_VAR2\n```', - detail: 'Auto-import', - textEdit: { range: marker2Range, newText: 'MY_CONST_VAR2' }, - additionalTextEdits: [{ range: import2Range, newText: ',\n MY_CONST_VAR2' }], - }, - ], - }, - marker3: { - completions: [ - { - label: 'Cls', - kind: Consts.CompletionItemKind.Class, - documentation: '```\nfrom lib import Cls\n```', - detail: 'Auto-import', - textEdit: { range: marker3Range, newText: 'Cls' }, - additionalTextEdits: [{ range: import2Range, newText: ',\n Cls' }], - }, - ], - }, - marker4: { - completions: [ - { - label: 'ClsOtherList', - kind: Consts.CompletionItemKind.Variable, - documentation: '```\nfrom lib import ClsOtherList\n```', - detail: 'Auto-import', - textEdit: { range: marker4Range, newText: 'ClsOtherList' }, - additionalTextEdits: [{ range: import3Range, newText: ',\n ClsOtherList' }], - }, - ], - }, - marker5: { - completions: [ - { - label: 'my_func', - kind: Consts.CompletionItemKind.Function, - documentation: '```\nfrom lib import my_func\n```', - detail: 'Auto-import', - textEdit: { range: marker5Range, newText: 'my_func' }, - additionalTextEdits: [{ range: import4Range, newText: ',\n my_func' }], - }, - ], - }, - marker6: { - completions: [ - { - label: 'MYA_CONST_VAR', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import MYA_CONST_VAR\n```', - detail: 'Auto-import', - textEdit: { range: marker6Range, newText: 'MYA_CONST_VAR' }, - additionalTextEdits: [{ range: import2Range, newText: ',\n MYA_CONST_VAR' }], - }, - ], - }, - marker7: { - completions: [ - { - label: 'MY_CONSTA_VAR', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import MY_CONSTA_VAR\n```', - detail: 'Auto-import', - textEdit: { range: marker7Range, newText: 'MY_CONSTA_VAR' }, - additionalTextEdits: [{ range: import2Range, newText: ',\n MY_CONSTA_VAR' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.lib.alias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.lib.alias.fourslash.ts deleted file mode 100644 index 45b69272..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.lib.alias.fourslash.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|job/*marker*/|] - -// @filename: test2.py -//// import dagster - -// @filename: dagster/py.typed -// @library: true -//// partial - -// @filename: dagster/__init__.py -// @library: true -//// from dagster.core.definitions import ( -//// job -//// ) -//// -//// __all__ = [ -//// "job" -//// ] - -// @filename: dagster/core/__init__.py -// @library: true -//// from builtins import * - -// @filename: dagster/core/definitions/__init__.py -// @library: true -//// from .decorators import ( -//// job -//// ) - -// @filename: dagster/core/definitions/decorators/__init__.py -// @library: true -//// from .job_decorator import job - -// @filename: dagster/core/definitions/decorators/job_decorator.py -// @library: true -//// def job(): -//// ... - -{ - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'job', - kind: Consts.CompletionItemKind.Function, - documentation: '```\nfrom dagster import job\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'job' }, - additionalTextEdits: [{ range: importRange, newText: 'from dagster import job\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.plainText.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.plainText.fourslash.ts deleted file mode 100644 index 726d4998..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.plainText.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|Test/*marker*/|] - -// @filename: test2.py -//// class Test: -//// pass - -{ - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('included', 'plaintext', { - marker: { - completions: [ - { - label: 'Test', - kind: Consts.CompletionItemKind.Class, - documentation: 'from test2 import Test', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'Test' }, - additionalTextEdits: [{ range: importRange, newText: 'from test2 import Test\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.shadow.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.shadow.fourslash.ts deleted file mode 100644 index ef9c6924..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.shadow.fourslash.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import*/|][|MyShadow/*marker*/|] - -// @filename: test2.py -//// import testLib -//// a = testLib.MyShadow() -//// a.[|/*hover*/method|]() - -// @filename: testLib/__init__.pyi -// @library: true -//// class MyShadow: -//// def method(self): ... - -// @filename: testLib/__init__.py -// @library: true -//// class MyShadow: -//// def method(self): -//// 'doc string' -//// pass - -{ - // This will cause shadow file to be injected. - helper.openFile(helper.getMarkerByName('hover').fileName); - helper.verifyHover('markdown', { - hover: '```python\n(method) def method() -> Unknown\n```\n---\ndoc string', - }); - - const importRange = helper.getPositionRange('import'); - const markerRange = helper.getPositionRange('marker'); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker: { - completions: [ - { - label: 'MyShadow', - kind: Consts.CompletionItemKind.Class, - documentation: '```\nfrom testLib import MyShadow\n```', - detail: 'Auto-import', - textEdit: { range: markerRange, newText: 'MyShadow' }, - additionalTextEdits: [{ range: importRange, newText: 'from testLib import MyShadow\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.submodule.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.submodule.fourslash.ts deleted file mode 100644 index a8a65d93..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.submodule.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import1*/|]from os.path import dirname -//// [|path/*marker1*/|] - -// @filename: test2.py -//// import os -//// a = os.path - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'path', - kind: Consts.CompletionItemKind.Variable, - documentation: '```\nfrom os import path\n```', - detail: 'Auto-import', - textEdit: { range: helper.getPositionRange('marker1'), newText: 'path' }, - additionalTextEdits: [ - { range: helper.getPositionRange('import1'), newText: 'from os import path\n' }, - ], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.topLevel.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.topLevel.fourslash.ts deleted file mode 100644 index e6bdf22b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.topLevel.fourslash.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// - -// @filename: test1.py -//// [|/*import1*/|][|os/*marker1*/|] - -// @filename: test2.py -//// [|/*import2*/|][|sys/*marker2*/|] - -// @filename: test3.py -//// import os -//// import sys -//// a = os.path -//// b = sys.path - -{ - helper.openFile('/test1.py'); - - const import1Range = helper.getPositionRange('import1'); - const marker1Range = helper.getPositionRange('marker1'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'os', - kind: Consts.CompletionItemKind.Module, - documentation: '```\nimport os\n```', - detail: 'Auto-import', - textEdit: { range: marker1Range, newText: 'os' }, - additionalTextEdits: [{ range: import1Range, newText: 'import os\n\n\n' }], - }, - ], - }, - }); - - helper.openFile('/test2.py'); - - const import2Range = helper.getPositionRange('import2'); - const marker2Range = helper.getPositionRange('marker2'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker2: { - completions: [ - { - label: 'sys', - kind: Consts.CompletionItemKind.Module, - documentation: '```\nimport sys\n```', - detail: 'Auto-import', - textEdit: { range: marker2Range, newText: 'sys' }, - additionalTextEdits: [{ range: import2Range, newText: 'import sys\n\n\n' }], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.unicode.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.unicode.fourslash.ts deleted file mode 100644 index 618acc29..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.autoimport.unicode.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: consume.py -//// [|/*import1*/|][|Ät/*marker1*/|] - -// @filename: declare.py -//// class Äther: ... -//// class Ether: ... - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'Äther', - kind: Consts.CompletionItemKind.Class, - documentation: '```\nfrom declare import Äther\n```', - detail: 'Auto-import', - textEdit: { range: helper.getPositionRange('marker1'), newText: 'Äther' }, - additionalTextEdits: [ - { range: helper.getPositionRange('import1'), newText: 'from declare import Äther\n\n\n' }, - ], - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.builtinDocstrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.builtinDocstrings.fourslash.ts deleted file mode 100644 index e2fbf35b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.builtinDocstrings.fourslash.ts +++ /dev/null @@ -1,117 +0,0 @@ -/// - -// @filename: docstrings.py -//// class A: ... -//// -//// class B: -//// """This is the class doc for B.""" -//// def __init__(self): -//// """This is the __init__ doc for B.""" -//// -//// class C: -//// """This is the class doc for C.""" -//// def __init__(self): -//// pass -//// -//// class D: -//// def __init__(self): -//// """This is the __init__ doc for D.""" -//// pass -//// -//// [|/*global*/|] -//// object().[|/*object*/|] -//// A().[|/*a*/|] -//// B().[|/*b*/|] -//// C().[|/*c*/|] -//// D().[|/*d*/|] - -// @filename: typeshed-fallback/stdlib/builtins.py -//// class object(): -//// """This is the class doc for object.""" -//// def __init__(self): -//// """This is the __init__ doc for object.""" -//// pass -//// -//// def __dir__(self): -//// """This is the __dir__ doc for object.""" -//// pass - -{ - // @ts-ignore - await helper.verifyCompletion('included', 'plaintext', { - global: { - completions: [ - { - label: 'object', - kind: Consts.CompletionItemKind.Class, - documentation: 'class object()\n\nThis is the class doc for object.', - }, - { - label: 'A', - kind: Consts.CompletionItemKind.Class, - documentation: 'class A()', - }, - { - label: 'B', - kind: Consts.CompletionItemKind.Class, - documentation: 'class B()\n\nThis is the class doc for B.', - }, - { - label: 'C', - kind: Consts.CompletionItemKind.Class, - documentation: 'class C()\n\nThis is the class doc for C.', - }, - { - label: 'D', - kind: Consts.CompletionItemKind.Class, - documentation: 'class D()', - }, - ], - }, - object: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - documentation: 'def __init__() -> None\n\nThis is the __init__ doc for object.', - }, - ], - }, - a: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - documentation: 'def __init__() -> None', - }, - ], - }, - b: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - documentation: 'def __init__() -> None\n\nThis is the __init__ doc for B.', - }, - ], - }, - c: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - documentation: 'def __init__() -> None', - }, - ], - }, - d: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - documentation: 'def __init__() -> None\n\nThis is the __init__ doc for D.', - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.builtinOverride.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.builtinOverride.fourslash.ts deleted file mode 100644 index 32cf9e81..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.builtinOverride.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @filename: test.py -//// Cust[|/*marker1*/|] -//// my_v[|/*marker2*/|] - -// @filename: __builtins__.pyi -//// class CustomClass: ... -//// my_var: int = ... - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: 'CustomClass', - kind: Consts.CompletionItemKind.Class, - }, - ], - }, - marker2: { completions: [{ label: 'my_var', kind: Consts.CompletionItemKind.Variable }] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.call.stringLiteral.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.call.stringLiteral.fourslash.ts deleted file mode 100644 index e7a7efc5..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.call.stringLiteral.fourslash.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// - -// @filename: test.py -//// from typing import Literal -//// -//// def thing(foo: Literal["hello", "world"]): -//// pass -//// -//// thing([|/*marker1*/|]) -//// thing(hel[|/*marker2*/|]) -//// thing([|"/*marker3*/"|]) - -{ - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: '"hello"', - kind: Consts.CompletionItemKind.Constant, - }, - { - label: '"world"', - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - marker2: { - completions: [ - { - label: '"hello"', - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker3: { - completions: [ - { - label: '"hello"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"hello"' }, - }, - { - label: '"world"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"world"' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.fourslash.ts deleted file mode 100644 index c1ddc679..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.fourslash.ts +++ /dev/null @@ -1,247 +0,0 @@ -/// - -// @filename: test.py -//// from typing import TypedDict, Optional, Union, List, Dict, Any -//// -//// class Movie(TypedDict): -//// name: str -//// age: int -//// -//// def thing(movie: Movie): -//// pass -//// -//// thing({'[|/*marker1*/|]'}) -//// thing({'name': '[|/*marker2*/|]'}) -//// thing({'name': 'Robert','[|/*marker3*/|]'}) -//// thing({'name': 'Robert', '[|/*marker4*/|]'}) -//// thing('[|/*marker5*/|]') -//// thing({'na[|/*marker6*/|]'}) -//// thing({[|/*marker7*/|]}) -//// thing({'a', '[|/*marker8*/|]'}) -//// -//// class Episode(TypedDict): -//// title: str -//// score: int -//// -//// def thing2(item: Union[Episode, Movie]): -//// pass -//// -//// thing2({'[|/*marker9*/|]'}) -//// thing2({'unknown': 'a', '[|/*marker10*/|]': ''}) -//// thing2({'title': 'Episode 01', '[|/*marker11*/|]': ''}) -//// -//// class Wrapper(TypedDict): -//// age: int -//// wrapped: Union[bool, Movie] -//// data: Dict[str, Any] -//// -//// def thing3(wrapper: Optional[Wrapper]): -//// pass -//// -//// thing3({'data': {'[|/*marker12*/|]'}}) -//// thing3({'wrapped': {'[|/*marker13*/|]'}}) -//// thing3({'age': 1, 'wrapped': {'[|/*marker14*/|]'}}) -//// thing3({'unknown': {'[|/*marker15*/|]'}}) -//// thing3({'age': {'[|/*marker16*/|]'}}) -//// thing3({'wrapped': {'name': 'ET', '[|/*marker17*/|]'}}) - -{ - const marker1Range = helper.expandPositionRange(helper.getPositionRange('marker1'), 1, 1); - const marker3Range = helper.expandPositionRange(helper.getPositionRange('marker3'), 1, 1); - const marker4Range = helper.expandPositionRange(helper.getPositionRange('marker4'), 1, 1); - const marker6Range = helper.expandPositionRange(helper.getPositionRange('marker6'), 3, 1); - const marker7Range = helper.getPositionRange('marker7'); - const marker8Range = helper.expandPositionRange(helper.getPositionRange('marker8'), 1, 1); - const marker9Range = helper.expandPositionRange(helper.getPositionRange('marker9'), 1, 1); - const marker10Range = helper.expandPositionRange(helper.getPositionRange('marker10'), 1, 1); - const marker11Range = helper.expandPositionRange(helper.getPositionRange('marker11'), 1, 1); - const marker13Range = helper.expandPositionRange(helper.getPositionRange('marker13'), 1, 1); - const marker14Range = helper.expandPositionRange(helper.getPositionRange('marker14'), 1, 1); - const marker17Range = helper.expandPositionRange(helper.getPositionRange('marker17'), 1, 1); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker1Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker1Range, newText: "'age'" }, - }, - ], - }, - marker2: { - completions: [], - }, - marker3: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: "'age'" }, - }, - ], - }, - marker4: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: "'age'" }, - }, - ], - }, - marker5: { - completions: [], - }, - marker6: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker6Range, newText: "'name'" }, - }, - ], - }, - marker8: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker8Range, newText: "'age'" }, - }, - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker8Range, newText: "'name'" }, - }, - ], - }, - marker9: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'age'" }, - }, - { - label: "'title'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'title'" }, - }, - { - label: "'score'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'score'" }, - }, - ], - }, - marker10: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker10Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker10Range, newText: "'age'" }, - }, - { - label: "'title'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker10Range, newText: "'title'" }, - }, - { - label: "'score'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker10Range, newText: "'score'" }, - }, - ], - }, - marker11: { - completions: [ - { - label: "'score'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker11Range, newText: "'score'" }, - }, - ], - }, - marker12: { - completions: [], - }, - marker13: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker13Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker13Range, newText: "'age'" }, - }, - ], - }, - marker14: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker14Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker14Range, newText: "'age'" }, - }, - ], - }, - marker15: { - completions: [], - }, - marker16: { - completions: [], - }, - marker17: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker17Range, newText: "'age'" }, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker7: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker7Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker7Range, newText: "'age'" }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.list.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.list.fourslash.ts deleted file mode 100644 index b6e7131e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.list.fourslash.ts +++ /dev/null @@ -1,163 +0,0 @@ -/// - -// @filename: test.py -//// from typing import TypedDict, Union, List -//// -//// class Movie(TypedDict): -//// name: str -//// age: int -//// -//// class MultipleInputs(TypedDict): -//// items: List[Movie] -//// union: Union[bool, List[Movie]] -//// unions: Union[Movie, Union[bool, List[Movie]]] -//// -//// def thing(inputs: MultipleInputs): -//// pass -//// -//// thing({'items': ['[|/*marker1*/|]']}) -//// thing({'items': {'[|/*marker2*/|]'}}) -//// thing({'items': [{'[|/*marker3*/|]'}]}) -//// thing({'union': [{'[|/*marker4*/|]'}]}) -//// thing({'unions': {'[|/*marker5*/|]'}}) -//// thing({'unions': [{'[|/*marker6*/|]'}]}) -//// -//// def thing2(movies: List[Movie]): -//// pass -//// -//// thing2([{'[|/*marker7*/|]'}]) -//// thing2({'[|/*marker8*/|]'}) -//// -//// class Wrapper(TypedDict): -//// wrapped: MultipleInputs -//// -//// def thing3(wrapper: Wrapper): -//// pass -//// -//// thing3({'wrapped': {'items': [{'[|/*marker9*/|]'}]}}) -//// thing3({'wrapped': {'items': {'[|/*marker10*/|]'}}}) -//// thing3({'wrapped': {'items': [{'a': 'b'}, {'[|/*marker11*/|]'}]}}) - -{ - const marker3Range = helper.expandPositionRange(helper.getPositionRange('marker3'), 1, 1); - const marker4Range = helper.expandPositionRange(helper.getPositionRange('marker4'), 1, 1); - const marker5Range = helper.expandPositionRange(helper.getPositionRange('marker5'), 1, 1); - const marker6Range = helper.expandPositionRange(helper.getPositionRange('marker6'), 1, 1); - const marker7Range = helper.expandPositionRange(helper.getPositionRange('marker7'), 1, 1); - const marker9Range = helper.expandPositionRange(helper.getPositionRange('marker9'), 1, 1); - const marker11Range = helper.expandPositionRange(helper.getPositionRange('marker11'), 1, 1); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [], - }, - marker2: { - completions: [], - }, - marker3: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: "'age'" }, - }, - ], - }, - marker4: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: "'age'" }, - }, - ], - }, - marker5: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker5Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker5Range, newText: "'age'" }, - }, - ], - }, - marker6: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker6Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker6Range, newText: "'age'" }, - }, - ], - }, - marker7: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker7Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker7Range, newText: "'age'" }, - }, - ], - }, - marker8: { - completions: [], - }, - marker9: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker9Range, newText: "'age'" }, - }, - ], - }, - marker10: { - completions: [], - }, - marker11: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker11Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker11Range, newText: "'age'" }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.states.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.states.fourslash.ts deleted file mode 100644 index e16d2187..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.call.typedDict.states.fourslash.ts +++ /dev/null @@ -1,135 +0,0 @@ -/// - -// @filename: test.py -//// from typing import TypedDict -//// -//// class Movie(TypedDict): -//// name: str -//// age: int -//// -//// def thing(movie: Movie): -//// pass -//// -//// thing(movie={'foo': 'a', '[|/*marker1*/|]'}) -//// thing(movie={'foo': 'a', 'a[|/*marker2*/|]'}) -//// thing( -//// movie={ -//// 'name': 'Parasite', -//// '[|/*marker3*/|] -//// } -//// ) -//// thing( -//// movie={ -//// 'name': 'Parasite', -//// '[|/*marker4*/|]' -//// } -//// ) -//// thing({ -//// 'name': 'Parasite', -//// # hello world -//// '[|/*marker5*/|]' -//// }) -//// thing({'foo': '[|/*marker6*/|]'}) - -{ - // completions that rely on token parsing instead of node parsing - const marker1Range = helper.expandPositionRange(helper.getPositionRange('marker1'), 1, 1); - const marker2Range = helper.expandPositionRange(helper.getPositionRange('marker2'), 2, 1); - const marker3Range = helper.expandPositionRange(helper.getPositionRange('marker3'), 1, 0); - const marker4Range = helper.expandPositionRange(helper.getPositionRange('marker4'), 1, 1); - const marker5Range = helper.expandPositionRange(helper.getPositionRange('marker5'), 1, 1); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker1Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker1Range, newText: "'age'" }, - }, - ], - }, - marker2: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker2Range, newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker2Range, newText: "'age'" }, - }, - ], - }, - marker6: { - completions: [], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker3: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: "'age'" }, - }, - ], - }, - marker4: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: "'age'" }, - }, - ], - }, - marker5: { - completions: [ - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker5Range, newText: "'age'" }, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker3: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - marker4: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - marker5: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.call.unpackedGenericTypedDict.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.call.unpackedGenericTypedDict.fourslash.ts deleted file mode 100644 index 3539d947..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.call.unpackedGenericTypedDict.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// Unpacked parameterized TypedDict as a variadic keyword parameter. -// expandTypedKwargs() (consumed by both signature help and completion literal-value suggestions) -// must substitute the TypedDict type argument. Before the fix, the `t` entry kept the unspecialized -// TypeVar `T@TD`, so no literal-value completions were offered; after the fix the entry is -// `Literal['a', 'b']`, so the literal values are offered at the call site. - -// @filename: test.py -//// from typing import Generic, Literal, TypedDict, TypeVar, Unpack -//// -//// T = TypeVar('T') -//// -//// class TD(TypedDict, Generic[T]): -//// t: T -//// -//// def func(**kwargs: Unpack[TD[Literal['a', 'b']]]) -> None: ... -//// -//// func(t=[|/*marker*/|]) - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: "'a'", - kind: Consts.CompletionItemKind.Constant, - }, - { - label: "'b'", - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.classVariable.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.classVariable.fourslash.ts deleted file mode 100644 index d17566d5..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.classVariable.fourslash.ts +++ /dev/null @@ -1,135 +0,0 @@ -/// -// @filename: viperconfig.json -//// { -//// "pythonVersion": "3.11" -//// } - -// @filename: test.py -//// class MyType: pass -//// -//// class B: -//// var1 = 1 -//// var2: MyType -//// var3: list[str] = ["hello"] -//// __var4 = 4 -//// -//// def __init__(self): -//// self.var6 = 1 -//// -//// class T(B): -//// var5: bool -//// [|va/*marker1*/|] -//// -//// class T1(B): -//// var2: [|/*marker2*/|] -//// -//// class T2(B): -//// var3: [|/*marker3*/|] - -// @filename: test2.py -//// from typing import Generic, Sequence, TypeVar -//// -//// -//// T = TypeVar("T") -//// -//// class A(Generic[T]): -//// var: Sequence[T] -//// -//// class B(A[int]): -//// var: [|/*marker4*/|] -//// -//// T2 = TypeVar("T2") -//// -//// class C(A[T2]): -//// var: [|/*marker5*/|] - -// @filename: test3.py -//// from typing import Generic, TypeVarTuple -//// -//// T = TypeVarTuple('T') -//// -//// class MyType(Generic[*T]): -//// pass -//// -//// class A(Generic[*T]): -//// var: MyType[*T] -//// -//// class B(A[int, str, float]): -//// var: [|/*marker6*/|] -//// -//// T2 = TypeVarTuple('T2') -//// -//// class C(A[int, *T2]): -//// var: [|/*marker7*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'var1', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'var2', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'var3', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, - marker2: { - completions: [ - { - label: 'MyType', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - marker3: { - completions: [ - { - label: 'list[str]', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - marker4: { - completions: [ - { - label: 'Sequence[int]', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - marker5: { - completions: [ - { - label: 'Sequence[T2]', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - marker6: { - completions: [ - { - label: 'MyType[int, str, float]', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - marker7: { - completions: [ - { - label: 'MyType[int, *T2]', - kind: Consts.CompletionItemKind.Reference, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.comment.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.comment.fourslash.ts deleted file mode 100644 index 31809ff4..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.comment.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: test.py -//// msg = 'hello' -//// [|/*marker1*/|] -//// # msg.[|/*marker2*/|] -//// [|/*marker3*/|] -//// print('upper: ' + msg.up[|/*marker4*/|]per()) -//// print('#upper: ' + msg.up[|/*marker5*/|]per()) -//// -//// # msg.[|/*marker6*/|] -//// [|/*marker7*/|] -//// - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker2: { completions: [] }, - marker6: { completions: [] }, -}); - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { completions: [{ label: 'msg', kind: Consts.CompletionItemKind.Variable }] }, - marker3: { completions: [{ label: 'msg', kind: Consts.CompletionItemKind.Variable }] }, - marker4: { completions: [{ label: 'upper', kind: Consts.CompletionItemKind.Method }] }, - marker5: { completions: [{ label: 'upper', kind: Consts.CompletionItemKind.Method }] }, - marker7: { completions: [{ label: 'msg', kind: Consts.CompletionItemKind.Variable }] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.class.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.class.fourslash.ts deleted file mode 100644 index d51d4d2f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.class.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// @filename: test.py -//// class [|/*marker1*/|] -//// - -// @filename: test1.py -//// class c[|/*marker2*/|] -//// - -// @filename: test2.py -//// class c1[|/*marker3*/|](): -//// pass -//// - -// @filename: test3.py -//// class c1([|/*marker4*/|]): -//// pass -//// - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker4: { completions: [{ label: 'Exception', kind: Consts.CompletionItemKind.Class }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.exception.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.exception.fourslash.ts deleted file mode 100644 index af878d28..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.exception.fourslash.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -// @filename: test.py -//// try: -//// pass -//// except ZeroDivisionError as d[|/*marker1*/|]: -//// pass -//// -//// try: -//// pass -//// except ZeroDivisionError as [|/*marker2*/|]: -//// pass - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.for.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.for.fourslash.ts deleted file mode 100644 index 790542b2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.for.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: test1.py -//// for [|/*marker1*/|] -//// - -// @filename: test2.py -//// for c[|/*marker2*/|] -//// - -// @filename: test3.py -//// for c1[|/*marker3*/|] in [1, 2]: -//// pass -//// - -// @filename: test4.py -//// [c for c[|/*marker4*/|] in [1, 2]] -//// - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [{ label: 'in', kind: Consts.CompletionItemKind.Keyword }] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { completions: [] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.importAlias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.importAlias.fourslash.ts deleted file mode 100644 index 38d5b8e7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.importAlias.fourslash.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -// @filename: test.py -//// import os as o[|/*marker1*/|] -//// import os as [|/*marker2*/|] -//// from os import path as p[|/*marker3*/|] -//// from os import path as [|/*marker4*/|] - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { completions: [] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.lambda.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.lambda.fourslash.ts deleted file mode 100644 index 489c8146..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.lambda.fourslash.ts +++ /dev/null @@ -1,45 +0,0 @@ -/// - -// @filename: test.py -//// lambda [|/*marker1*/|] - -// @filename: test1.py -//// lambda x[|/*marker2*/|] - -// @filename: test2.py -//// lambda x[|/*marker3*/|]: - -// @filename: test3.py -//// lambda x, [|/*marker4*/|] - -// @filename: test4.py -//// lambda x, [|/*marker5*/|]: - -// @filename: test5.py -//// lambda x, y[|/*marker6*/|] - -// @filename: test6.py -//// lambda x, y[|/*marker7*/|]: - -// @filename: test7.py -//// lambda x: [|/*marker8*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { completions: [] }, - marker5: { completions: [] }, - marker6: { completions: [] }, - marker7: { completions: [] }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker8: { completions: [{ label: 'str', kind: Consts.CompletionItemKind.Class }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.method.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.method.fourslash.ts deleted file mode 100644 index 7cbacdeb..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.method.fourslash.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// - -// @filename: test.py -//// def [|/*marker1*/|] -//// -//// def d[|/*marker2*/|] -//// -//// def d1[|/*marker3*/|](): -//// pass -//// -//// async def [|/*marker4*/|] -//// -//// async def a[|/*marker5*/|] -//// -//// async def a1[|/*marker6*/|](): -//// pass -//// -//// def method(x[|/*marker7*/|]): -//// pass -//// def method(x:[|/*marker8*/|]): -//// pass -//// -//// def method(x, x2[|/*marker9*/|]): -//// pass -//// def method(x, x2:[|/*marker10*/|]): -//// pass - -// @filename: test1.py -//// class A: -//// def a1[|/*marker11*/|] -//// -//// def a2[|/*marker12*/|](): -//// pass -//// -//// def method(x[|/*marker13*/|]): -//// pass -//// def method(x:[|/*marker14*/|]): -//// pass -//// -//// def method(x, x2[|/*marker15*/|]): -//// pass -//// def method(x, x2:[|/*marker16*/|]): -//// pass - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { completions: [] }, - marker5: { completions: [] }, - marker6: { completions: [] }, - marker7: { completions: [] }, - marker9: { completions: [] }, - marker11: { completions: [] }, - marker12: { completions: [] }, - marker13: { completions: [] }, - marker15: { completions: [] }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker8: { completions: [{ label: 'str', kind: Consts.CompletionItemKind.Class }] }, - marker10: { completions: [{ label: 'str', kind: Consts.CompletionItemKind.Class }] }, - marker14: { completions: [{ label: 'str', kind: Consts.CompletionItemKind.Class }] }, - marker16: { completions: [{ label: 'str', kind: Consts.CompletionItemKind.Class }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.overload.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.overload.fourslash.ts deleted file mode 100644 index 8ae90e0c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.overload.fourslash.ts +++ /dev/null @@ -1,156 +0,0 @@ -/// - -// @filename: test1.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def [|met/*marker1*/|] - -// @filename: test2.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def [|met/*marker2*/|]() - -// @filename: test3.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def [|met/*marker3*/|](): -//// pass - -// @filename: test4.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def method(self): -//// pass -//// @overload -//// def [|met/*marker4*/|] - -// @filename: test5.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass -//// @overload -//// def [|met/*marker5*/|] - -// @filename: test6.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass -//// @overload -//// def [|diff/*marker6*/|] - -// @filename: test7.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass -//// -//// class B(A): -//// @overload -//// def method3(self): -//// pass -//// @overload -//// def [|met/*marker7*/|] - -// @filename: test8.py -//// from typing import overload -//// -//// class A: -//// @overload -//// def method(self): -//// pass -//// @overload -//// def [|method/*marker8*/|](self, a): -//// pass - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - const marker4Range = helper.getPositionRange('marker4'); - const marker5Range = helper.getPositionRange('marker5'); - const marker7Range = helper.getPositionRange('marker7'); - const marker8Range = helper.getPositionRange('marker8'); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker4Range, newText: 'method' }, - }, - ], - }, - marker5: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker5Range, newText: 'method' }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker5Range, newText: 'method2' }, - }, - ], - }, - marker6: { completions: [] }, - marker7: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker7Range, newText: 'method' }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker7Range, newText: 'method2' }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker7Range, newText: 'method3' }, - }, - ], - }, - marker8: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Method, - textEdit: { range: marker8Range, newText: 'method' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.topLevelOverload.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.declNames.topLevelOverload.fourslash.ts deleted file mode 100644 index cb941b6e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.declNames.topLevelOverload.fourslash.ts +++ /dev/null @@ -1,141 +0,0 @@ -/// - -// @filename: test1.py -//// from typing import overload -//// -//// @overload -//// def [|met/*marker1*/|] - -// @filename: test2.py -//// from typing import overload -//// -//// @overload -//// def [|met/*marker2*/|]() - -// @filename: test3.py -//// from typing import overload -//// -//// @overload -//// def [|met/*marker3*/|](): -//// pass - -// @filename: test4.py -//// from typing import overload -//// -//// @overload -//// def method(self): -//// pass -//// @overload -//// def [|met/*marker4*/|] - -// @filename: test5.py -//// from typing import overload -//// -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass -//// @overload -//// def [|met/*marker5*/|] - -// @filename: test6.py -//// from typing import overload -//// -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass -//// @overload -//// def [|diff/*marker6*/|] - -// @filename: test7.py -//// from typing import overload -//// -//// @overload -//// def method(self): -//// pass -//// @overload -//// def method2(self): -//// pass - -// @filename: test7-1.py -//// from typing import overload -//// from test7 import method, method2 -//// -//// @overload -//// def method3(self): -//// pass -//// @overload -//// def [|met/*marker7*/|] - -// @filename: test8.py -//// from typing import overload -//// -//// @overload -//// def method(self): -//// pass -//// @overload -//// def [|method/*marker8*/|](self, a): -//// pass - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - const marker4Range = helper.getPositionRange('marker4'); - const marker5Range = helper.getPositionRange('marker5'); - const marker7Range = helper.getPositionRange('marker7'); - const marker8Range = helper.getPositionRange('marker8'); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Function, - textEdit: { range: marker4Range, newText: 'method' }, - }, - ], - }, - marker5: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Function, - textEdit: { range: marker5Range, newText: 'method' }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Function, - textEdit: { range: marker5Range, newText: 'method2' }, - }, - ], - }, - marker6: { completions: [] }, - marker7: { - completions: [ - { - label: 'method3', - kind: Consts.CompletionItemKind.Function, - textEdit: { range: marker7Range, newText: 'method3' }, - }, - ], - }, - marker8: { - completions: [ - { - label: 'method', - kind: Consts.CompletionItemKind.Function, - textEdit: { range: marker8Range, newText: 'method' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.complex.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.complex.fourslash.ts deleted file mode 100644 index 508a7dad..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.complex.fourslash.ts +++ /dev/null @@ -1,76 +0,0 @@ -/// - -// @filename: dict_key_complex.py -//// d = { "key" : 1 } -//// -//// if (len(d) > 0): -//// d["ifKey"] = 2 -//// -//// def foo(): -//// d["capturedKey"] = 3 -//// -//// class C: -//// def method(self): -//// d["capturedInsideOfMethod"] = 4 -//// -//// d = dict(reassignedKey=5) -//// -//// d[[|/*marker1*/|]] - -// @filename: dict_expression_symbol.py -//// keyString = "key" -//// d = { keyString : 1 } -//// d[k/*marker2*/] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"ifKey"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"ifKey"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"capturedKey"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"capturedKey"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"capturedInsideOfMethod"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"capturedInsideOfMethod"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"reassignedKey"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"reassignedKey"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [{ label: 'keyString', kind: Consts.CompletionItemKind.Variable }], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker2: { - // Regular symbol should over take dict key. - completions: [{ label: 'keyString', kind: Consts.CompletionItemKind.Constant }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.expression.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.expression.fourslash.ts deleted file mode 100644 index eb577dba..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.expression.fourslash.ts +++ /dev/null @@ -1,75 +0,0 @@ -/// - -// @filename: dict_expression_number.py -//// d = { 1: 1 } -//// d[2] = 1 -//// d[/*marker1*/] - -// @filename: dict_expression_tuple.py -//// d = { (1, 2): 1 } -//// d[(2, 3)] = 1 -//// d[/*marker2*/] - -// @filename: dict_expression_key_expression.py -//// d = { 1 + 2: 1 } -//// d[2 + 3] = 1 -//// d[/*marker3*/] - -// @filename: dict_expression_partial_expression.py -//// d = { "key" : 1 } -//// d["key2"] = 1 -//// d[[|key/*marker4*/|]] - -// @filename: dict_expression_complex_key.py -//// class C: -//// key = "name" -//// -//// d = { C.key : 1 } -//// d[key/*marker5*/] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { label: '1', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - { label: '2', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - ], - }, - marker2: { - completions: [ - { label: '(1, 2)', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - { label: '(2, 3)', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - ], - }, - marker3: { - completions: [ - { label: '1 + 2', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - { label: '2 + 3', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - ], - }, - marker4: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker5: { - completions: [ - { label: 'C.key', kind: Consts.CompletionItemKind.Constant, detail: Consts.IndexValueDetail }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.ts deleted file mode 100644 index 0ef1af1e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.ts +++ /dev/null @@ -1,161 +0,0 @@ -/// - -// @filename: literal_types.py -//// from typing import Mapping, Literal -//// -//// d: Mapping[Literal["key", "key2"], int] = { "key" : 1 } -//// d[[|/*marker1*/|]] - -// @filename: parameter_mapping.py -//// from typing import Mapping, Literal -//// -//// def foo(d: Mapping[Literal["key", "key2"], int]): -//// d[[|/*marker2*/|]] - -// @filename: literal_types_mixed.py -//// from typing import Mapping, Literal -//// -//// d: Mapping[Literal["key", 1], int] = { "key" : 1 } -//// d[[|/*marker3*/|]] - -// @filename: parameter_dict.py -//// from typing import Dict, Literal -//// -//// def foo(d: Dict[Literal["key", "key2"], int]): -//// d[[|/*marker4*/|]] - -// @filename: literal_types_boolean.py -//// from typing import Dict, Literal -//// -//// d: Dict[Literal[True, False], int] = { True: 1, False: 2 } -//// d[[|/*marker5*/|]] - -// @filename: literal_types_enum.py -//// from typing import Dict, Literal -//// from enum import Enum -//// -//// class MyEnum(Enum): -//// red = 1 -//// blue = 2 -//// -//// def foo(d: Dict[Literal[MyEnum.red, MyEum.blue], int]): -//// d[[|/*marker6/|]] - -// @filename: literal_bytes.py -//// from typing import Mapping, Literal -//// -//// d: Mapping[Literal[b"key", b"key2"], int] = { b"key" : 1 } -//// d[[|/*marker7*/|]] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker3: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '1', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker4: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker5: { - completions: [ - { - label: 'True', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - { - label: 'False', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker6: { - completions: [ - { - label: 'MyEnum.red', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - { - label: 'MyEnum.blue', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker7: { - completions: [ - { - label: 'b"key"', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - { - label: 'b"key2"', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.simple.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.simple.fourslash.ts deleted file mode 100644 index 41c00a06..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.simple.fourslash.ts +++ /dev/null @@ -1,151 +0,0 @@ -/// - -// @filename: simple_dict_expression.py -//// d = { "key" : 1 } -//// d[[|/*marker1*/|]] - -// @filename: simple_dict_constructor.py -//// d = dict(key=1) -//// d[[|/*marker2*/|]] - -// @filename: dict_expression_index.py -//// d = {} -//// d["key"] = 1 -//// d[[|/*marker3*/|]] - -// @filename: dict_constructor_index.py -//// d = dict() -//// d["key"] = 1 -//// d[[|/*marker4*/|]] - -// @filename: dict_expression_multiple_keys.py -//// d = { "key": 1, "key2": 2 } -//// d["key3"] = 3 -//// d[[|/*marker5*/|]] - -// @filename: dict_constructor_multiple_keys.py -//// d = dict(key=1, key2=2) -//// d["key3"] = 3 -//// d[[|/*marker6*/|]] - -// @filename: dict_expression_typeAnnotation.py -//// from typing import Mapping -//// d: Mapping[str, int] = { "key": 1} -//// d[[|/*marker7*/|]] - -// @filename: dict_constructor_typeAnnotation.py -//// from typing import Mapping -//// d: Mapping[str, int] = dict(key=1) -//// d[[|/*marker8*/|]] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [ - { - label: "'key'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: "'key'" }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker3: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker4: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker5: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker5'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker5'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key3"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker5'), newText: '"key3"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker6: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker6'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker6'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"key3"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker6'), newText: '"key3"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker7: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker7'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker8: { - completions: [ - { - label: "'key'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker8'), newText: "'key'" }, - detail: Consts.IndexValueDetail, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.ts deleted file mode 100644 index 0cb2ae77..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.ts +++ /dev/null @@ -1,121 +0,0 @@ -/// - -// @filename: string_literals.py -//// d = { "key" : 1 } -//// d[[|"/*marker1*/"|]] - -// @filename: dict_constructor.py -//// d = dict(key=1) -//// d[[|"/*marker2*/"|]] - -// @filename: dict_key_no_end.py -//// d = { "key": 1 } -//// d[[|"/*marker3*/|]] - -// @filename: dict_key_partial.py -//// d = dict(key=1) -//// d[[|"k/*marker4*/"|]] - -// @filename: dict_key_stringLiteralsOnly.py -//// name = "key" -//// d = { name: 1 } -//// d["key2"] = 2 -//// d[[|/*marker5*/|]] - -// @filename: dict_key_name_conflicts.py -//// keyString = "key" -//// d = dict(keyString=1) -//// d[[|keyStr/*marker6*/|]] - -// @filename: dict_key_mixed_literals.py -//// d = { "key": 1, 1 + 2: 1 } -//// d[[|/*marker7*/|]] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker3: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker4: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker5: { - completions: [ - { - label: 'name', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - { - label: '"key2"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker5'), newText: '"key2"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker6: { - completions: [ - { label: 'keyString', kind: Consts.CompletionItemKind.Variable }, - { - label: '"keyString"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker6'), newText: '"keyString"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker7: { - completions: [ - { - label: '"key"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker7'), newText: '"key"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '1 + 2', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.symbols.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.symbols.fourslash.ts deleted file mode 100644 index 0498ac20..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dictionary.keys.symbols.fourslash.ts +++ /dev/null @@ -1,53 +0,0 @@ -/// - -// @filename: string_literals_with_symbols.py -//// d = { "key-1" : 1 } -//// d[[|"/*marker1*/"|]] - -// @filename: string_literals_with_symbols2.py -//// d = { "key\"yo\"" : 1 } -//// d[[|"/*marker2*/"|]] - -// @filename: string_literals_duplicates.py -//// d = { "hello" : 1 } -//// d["hello"] = 2 -//// -//// d[[|"/*marker3*/"|]] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: '"key-1"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: '"key-1"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [ - { - label: '"key\\"yo\\""', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"key\\"yo\\""' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker3: { - completions: [ - { - label: '"hello"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"hello"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.Inheritance.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.Inheritance.fourslash.ts deleted file mode 100644 index 9378129f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.Inheritance.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: test.py -//// class Parent: -//// def __init__(self, *args: Any, **kwargs: Any): -//// pass -//// -//// def __new__(cls, *args: Any, **kwargs: Any): -//// pass -//// -//// class Child(Parent): -//// def __new__(cls, name:str): -//// return super().__new__(cls, name) -//// -//// class GrandChild(Child): -//// pass - -//// x = GrandChild([|/*marker1*/|]) - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'name=', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.fourslash.ts deleted file mode 100644 index 4a7dbb16..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.dunderNew.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -// @filename: test.py -//// class Foo: -//// def __new__(cls, name: str): -//// return super().__new__(cls) -//// -//// x = Foo([|/*marker1*/|]) - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'name=', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.enums.members.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.enums.members.fourslash.ts deleted file mode 100644 index bf2e6f06..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.enums.members.fourslash.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// - -// @filename: test.py -//// from enum import Enum -//// class Color(Enum): -//// RED = 1 -//// GREEN = 2 -//// BLUE = 3 -//// -//// NotAMember: int = 3 -//// -//// @property -//// def a_prop(self): -//// pass -//// -//// Color./*marker*/ - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'BLUE', - kind: Consts.CompletionItemKind.EnumMember, - }, - { - label: 'GREEN', - kind: Consts.CompletionItemKind.EnumMember, - }, - { - label: 'RED', - kind: Consts.CompletionItemKind.EnumMember, - }, - { - label: 'a_prop', - kind: Consts.CompletionItemKind.Property, - }, - { - label: 'NotAMember', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.errorNodes.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.errorNodes.fourslash.ts deleted file mode 100644 index 74f6c8c3..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.errorNodes.fourslash.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -// @filename: test.py -//// import os - -//// class App(): -//// def __init(self): -//// self.instance_path = "\\foo" - -//// app = App() -//// try: -//// os.makedirs(app.in[|/*marker*/|]) - -//// except: -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'instance_path', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.excluded.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.excluded.fourslash.ts deleted file mode 100644 index b295ef52..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.excluded.fourslash.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @filename: test.py -//// a = 42 -//// a.n[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('excluded', 'markdown', { - marker1: { - completions: [{ label: 'capitalize', kind: undefined }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.fourslash.ts deleted file mode 100644 index bfa63d8e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.fourslash.ts +++ /dev/null @@ -1,51 +0,0 @@ -/// - -// @filename: test.py -//// import time -//// time.gm[|/*marker1*/|] -//// aaaaaa = 100 -//// aaaaa[|/*marker2*/|] -//// def some_func1(a): -//// '''some function docs''' -//// pass -//// def some_func2(a): -//// '''another function docs''' -//// pass -//// some_fun[|/*marker3*/|] -//// unknownVariable.[|/*marker4*/|] - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: 'gmtime', - kind: Consts.CompletionItemKind.Function, - }, - { - label: 'clock_gettime', - kind: Consts.CompletionItemKind.Function, - }, - { - label: 'clock_gettime_ns', - kind: Consts.CompletionItemKind.Function, - }, - ], - }, - marker2: { completions: [{ label: 'aaaaaa', kind: Consts.CompletionItemKind.Variable }] }, - marker3: { - completions: [ - { - label: 'some_func1', - kind: Consts.CompletionItemKind.Function, - documentation: '```python\ndef some_func1(a: Unknown) -> None\n```\n---\nsome function docs', - }, - { - label: 'some_func2', - kind: Consts.CompletionItemKind.Function, - documentation: '```python\ndef some_func2(a: Unknown) -> None\n```\n---\nanother function docs', - }, - ], - }, - marker4: { completions: [] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.fstring.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.fstring.fourslash.ts deleted file mode 100644 index d21cc9d7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.fstring.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: test.py -//// msg = "gekki" -//// -//// a = f"{[|/*marker1*/|]}" -//// b = f"{msg.c[|/*marker2*/|]}" -//// c = f"{msg.[|/*marker3*/|]}" -//// d = f"msg.[|/*marker4*/|]{msg}" -//// e = f"{msg}msg.[|/*marker5*/|]" - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: 'msg', kind: Consts.CompletionItemKind.Variable }], - }, - marker2: { - completions: [{ label: 'count', kind: Consts.CompletionItemKind.Method }], - }, - marker3: { - completions: [{ label: 'capitalize', kind: Consts.CompletionItemKind.Method }], - }, -}); - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker4: { - completions: [], - }, - marker5: { - completions: [], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.fstring.stringLiteral.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.fstring.stringLiteral.fourslash.ts deleted file mode 100644 index b1d353da..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.fstring.stringLiteral.fourslash.ts +++ /dev/null @@ -1,96 +0,0 @@ -/// - -// @filename: test.py -//// from typing import TypedDict -//// -//// class Movie(TypedDict): -//// name: str -//// age: int -//// -//// m = Movie(name="hello", age=10) -//// -//// a = f"{m[[|/*marker1*/|]]}" -//// b = f'{m[[|/*marker2*/|]]}' -//// c = f'{m[[|"ag/*marker3*/"|]]}' -//// -//// -//// -//// m2 = { 'name' : "hello" } -//// -//// d = f"{m2[[|/*marker4*/|]]}" -//// e = f'{m2[[|/*marker5*/|]]}' -//// f = f'{m2[[|"na/*marker6*/"|]]}' -//// - -{ - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: "'name'" }, - }, - { - label: "'age'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: "'age'" }, - }, - ], - }, - marker2: { - completions: [ - { - label: '"name"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"name"' }, - }, - { - label: '"age"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"age"' }, - }, - ], - }, - marker3: { - completions: [ - { - label: '"age"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"age"' }, - }, - ], - }, - marker4: { - completions: [ - { - label: "'name'", - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - textEdit: { range: helper.getPositionRange('marker4'), newText: "'name'" }, - }, - ], - }, - marker5: { - completions: [ - { - label: '"name"', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - textEdit: { range: helper.getPositionRange('marker5'), newText: '"name"' }, - }, - ], - }, - marker6: { - completions: [ - { - label: '"name"', - kind: Consts.CompletionItemKind.Constant, - detail: Consts.IndexValueDetail, - textEdit: { range: helper.getPositionRange('marker6'), newText: '"name"' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.fuzzyMatching.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.fuzzyMatching.fourslash.ts deleted file mode 100644 index 0ccf7365..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.fuzzyMatching.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: test.py -//// from unittest.mock import MagicMock -//// mock = MagicMock() -//// mock.call[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'call_args', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'called', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: '__call__', - kind: Consts.CompletionItemKind.Method, - }, - { - label: 'assert_called', - kind: Consts.CompletionItemKind.Method, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.dunderNames.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.dunderNames.fourslash.ts deleted file mode 100644 index 771734c2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.dunderNames.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test.py -//// import _[|/*marker1*/|] -//// import __pycache__[|/*marker2*/|] -//// from test2 import _[|/*marker3*/|] -//// from test2 import [|/*marker4*/|] - -// @filename: test2.py -//// def foo(): -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: '__future__', kind: Consts.CompletionItemKind.Module }], - }, - marker4: { - completions: [{ label: 'foo', kind: Consts.CompletionItemKind.Function }], - }, -}); - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker2: { - completions: [], - }, - marker3: { - completions: [], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.duplicates.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.duplicates.fourslash.ts deleted file mode 100644 index 8191766f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.duplicates.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -// @filename: test_no_duplicate_tseries_completions.py -//// from testLib import [|t/*marker*/|] - -// @filename: testLib/__init__.pyi -// @library: true -//// import tseries -//// __all__ = ['tseries'] - -// @filename: testLib/tseries/__init__.pyi -// @library: true -// - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker: { - completions: [ - { - label: 'tseries', - kind: Consts.CompletionItemKind.Module, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.exactMatch.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.exactMatch.fourslash.ts deleted file mode 100644 index 5aae9dcd..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.exactMatch.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: test.py -//// from testLib import [|/*marker1*/|]En[|/*marker2*/|]um[|/*marker3*/|] - -// @filename: testLib.py -//// class Enum: pass -//// class EnumCheck: pass - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { label: 'Enum', kind: Consts.CompletionItemKind.Class }, - { label: 'EnumCheck', kind: Consts.CompletionItemKind.Class }, - ], - }, - marker2: { - completions: [ - { label: 'Enum', kind: Consts.CompletionItemKind.Class }, - { label: 'EnumCheck', kind: Consts.CompletionItemKind.Class }, - ], - }, - marker3: { - completions: [ - { label: 'Enum', kind: Consts.CompletionItemKind.Class }, - { label: 'EnumCheck', kind: Consts.CompletionItemKind.Class }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.ts deleted file mode 100644 index 13d1fc54..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -// @filename: test.py -//// from testLib import Enum, Enu[|/*marker1*/|] - -// @filename: testLib.py -//// class Enum: pass -//// class EnumCheck: pass - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [{ label: 'EnumCheck', kind: Consts.CompletionItemKind.Class }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.interimFile.fourslash.disabled.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.interimFile.fourslash.disabled.ts deleted file mode 100644 index 4a73d159..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.interimFile.fourslash.disabled.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// - -// @filename: test1.py -//// import al[|/*marker1*/|] - -// @filename: altair/__init__.py -// @library: true -//// """module docstring""" -//// -//// __all__ = [ "selection_interval" ] -//// -//// from .vegalite import ( -//// selection, -//// selection_interval -//// ) - -// @filename: altair/vegalite/__init__.py -// @library: true -//// def selection(): pass -//// def selection_interval(): pass - -// @filename: altair/py.typed -// @library: true -//// # has to contain something for file to be written - -{ - // Force interim file to be created - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { label: 'altair', kind: Consts.CompletionItemKind.Module, documentation: 'module docstring' }, - ], - }, - }); - - helper.replace(helper.BOF, helper.getMarkerByName('marker1').position, 'import altair as alt\n\nalt.'); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: 'selection_interval', kind: Consts.CompletionItemKind.Function }], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker1: { - completions: [{ label: 'selection', kind: Consts.CompletionItemKind.Function }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.privateNoPytyped.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.privateNoPytyped.fourslash.ts deleted file mode 100644 index 727b8aec..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.privateNoPytyped.fourslash.ts +++ /dev/null @@ -1,32 +0,0 @@ -// @filename: test_private_completions.py -//// import testLib.[|/*marker*/|] - -// @filename: testLib/__init__.py -// @library: true -//// # empty - -// @filename: testLib/__privateclass.py -// @library: true -//// class PrivateClass(): -//// pass - -// @filename: testLib/publicclass.py -// @library: true -//// class PublicClass(): -//// pass - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker: { - completions: [ - { - label: 'publicclass', - kind: Consts.CompletionItemKind.Module, - }, - { - label: '__privateclass', - kind: Consts.CompletionItemKind.Module, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.pytyped.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.pytyped.fourslash.ts deleted file mode 100644 index cf0c1b5b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.pytyped.fourslash.ts +++ /dev/null @@ -1,32 +0,0 @@ -// @filename: test_no_private_completions.py -//// import testLib.[|/*marker*/|] - -// @filename: testLib/__init__.py -// @library: true -//// # empty - -// @filename: testLib/__privateclass.py -// @library: true -//// class PrivateClass(): -//// pass - -// @filename: testLib/publicclass.py -// @library: true -//// class PublicClass(): -//// pass - -// @filename: testLib/py.typed -// @library: true -//// # has to contain something for file to be written - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker: { - completions: [ - { - label: 'publicclass', - kind: Consts.CompletionItemKind.Module, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.pytypedLocal.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.pytypedLocal.fourslash.ts deleted file mode 100644 index 2df02231..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.pytypedLocal.fourslash.ts +++ /dev/null @@ -1,32 +0,0 @@ -// @filename: test_no_private_completions.py -//// import testLib.[|/*marker*/|] - -// @filename: testLib/__init__.py -//// # empty - -// @filename: testLib/__privateclass.py -//// class PrivateClass(): -//// pass - -// @filename: testLib/publicclass.py -//// class PublicClass(): -//// pass - -// @filename: testLib/py.typed -//// # has to contain something for file to be written - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker: { - completions: [ - { - label: 'publicclass', - kind: Consts.CompletionItemKind.Module, - }, - { - label: '__privateclass', - kind: Consts.CompletionItemKind.Module, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.import.submodule.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.import.submodule.fourslash.ts deleted file mode 100644 index 233447f2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.import.submodule.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: test.py -//// from submodule.[|/*marker1*/|] - -// @filename: viperconfig.json -//// { -//// "extraPaths": ["submodule"] -//// } - -// @filename: submodule/submodule/__init__.py -//// - -// @filename: submodule/submodule/submodule1.py -//// def test_function(): -//// pass - -// @filename: submodule/setup.py -//// - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [{ label: 'submodule1', kind: Consts.CompletionItemKind.Module }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inList.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inList.fourslash.ts deleted file mode 100644 index 70ecd6f9..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inList.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: testList.py -//// a = 42 -//// x = [ -//// a.[|/*marker1*/|] -//// ] - -// @filename: testListWithCall.py -//// b = 42 -//// y = [ -//// print(b.[|/*marker2*/|]) -//// ] - -// @filename: testListWithCallMissingClosedParens.py -//// b = 42 -//// y = [ -//// print(b.[|/*marker3*/|] -//// ] -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: 'numerator', kind: Consts.CompletionItemKind.Property }], - }, - marker2: { - completions: [{ label: 'numerator', kind: Consts.CompletionItemKind.Property }], - }, - marker3: { - completions: [{ label: 'numerator', kind: Consts.CompletionItemKind.Property }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.included.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.included.fourslash.ts deleted file mode 100644 index bec83ca6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.included.fourslash.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @filename: test.py -//// a = 42 -//// a.n[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: 'numerator', kind: Consts.CompletionItemKind.Property }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.indexer.keys.getitem.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.indexer.keys.getitem.fourslash.ts deleted file mode 100644 index 0903833b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.indexer.keys.getitem.fourslash.ts +++ /dev/null @@ -1,103 +0,0 @@ -/// - -// @filename: getitem.py -//// from typing import Literal, Generic, TypeVar, overload -//// class ClassA: -//// def __getitem__(self, key: Literal['a', 'b']): -//// pass -//// T = TypeVar("T") -//// class ClassB(Generic[T]): -//// @overload -//// def __getitem__(self, key: T): -//// pass -//// @overload -//// def __getitem__(self, key: Literal['foo']): -//// pass - -// @filename: test1.py -//// from typing import Literal -//// from getitem import ClassA, ClassB -//// a = ClassA() -//// a[[|/*marker1*/|]] -//// b = ClassB[Literal['x']]() -//// b[[|/*marker2*/|]] - -// @filename: test2.py -//// from typing import Literal -//// from getitem import ClassA, ClassB -//// a = ClassA() -//// a[[|"/*marker3*/"|]] -//// b = ClassB[Literal['x']]() -//// b[[|"/*marker4*/"|]] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: "'a'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: "'a'" }, - detail: Consts.IndexValueDetail, - }, - { - label: "'b'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker1'), newText: "'b'" }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker2: { - completions: [ - { - label: "'x'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: "'x'" }, - detail: Consts.IndexValueDetail, - }, - { - label: "'foo'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: "'foo'" }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker3: { - completions: [ - { - label: '"a"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"a"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"b"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: '"b"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - marker4: { - completions: [ - { - label: '"x"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"x"' }, - detail: Consts.IndexValueDetail, - }, - { - label: '"foo"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker4'), newText: '"foo"' }, - detail: Consts.IndexValueDetail, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.function.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inherited.function.docFromStub.fourslash.ts deleted file mode 100644 index 9ef4f96d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.function.docFromStub.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: testFunctionWithVariableStub.py -//// import module1 -//// -//// module1.[|/*marker1*/displayhook|] - -// @filename: module1.py -//// def displayhook() -> None: -//// '''displayhook docs''' -//// ... - -// @filename: module1.pyi -//// from typing import Callable -//// displayhook: Callable[[],Any] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'displayhook', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\ndef displayhook() -> Unknown\n```\n---\ndisplayhook docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.ts deleted file mode 100644 index 23a5b6a9..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// - -// @filename: overloads_client.py -//// from typing import overload -//// import moduleA -//// -//// class ChildA(moduleA.A): -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass -//// -//// -//// ChildA.f[|/*marker1*/|] - -// @filename: typings/moduleA.pyi -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: ... -//// -//// @overload -//// def func(self, x: int) -> int: ... - -// @filename: typings/moduleA.py -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// '''func docs''' -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'func', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef func(self: ChildA, x: str) -> str: ...\ndef func(self: ChildA, x: int) -> int: ...\n```\n---\nfunc docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.ts deleted file mode 100644 index 14217e80..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.ts +++ /dev/null @@ -1,53 +0,0 @@ -/// - -// @filename: overloads_client.py -//// from typing import overload -//// import moduleA -//// -//// class ChildA(moduleA.A): -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass -//// -//// -//// ChildA.f[|/*marker1*/|] - -// @filename: typings/moduleA.pyi -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: ... -//// -//// @overload -//// def func(self, x: int) -> int: -//// '''func docs''' -//// ... - -// @filename: typings/moduleA.py -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'func', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef func(self: ChildA, x: str) -> str: ...\ndef func(self: ChildA, x: int) -> int: ...\n```\n---\nfunc docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.ts deleted file mode 100644 index dd8b5c01..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.ts +++ /dev/null @@ -1,104 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// class ChildGetterDocs(testLib.ClassWithGetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ChildSetterDocs(testLib.ClassWithSetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// one = ChildGetterDocs(3) -//// one.lengt[|/*marker1*/|] -//// two = ChildSetterDocs(3) -//// two.lengt[|/*marker2*/|] - -// @filename: testLib/__init__.py -//// class ClassWithGetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// """ -//// read property doc -//// """ -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ClassWithSetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// """ -//// setter property doc -//// """ -//// pass -//// - -// @filename: testLib/__init__.pyi -//// class ClassWithGetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: ... -//// -//// class ClassWithSetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: ... - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nread property doc', - }, - ], - }, - marker2: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nsetter property doc', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromStub.fourslash.ts deleted file mode 100644 index 068f4238..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.inherited.property.docFromStub.fourslash.ts +++ /dev/null @@ -1,108 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// class ChildGetterDocs(testLib.ClassWithGetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ChildSetterDocs(testLib.ClassWithSetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// one = ChildGetterDocs(3) -//// one.lengt[|/*marker1*/|] -//// two = ChildSetterDocs(3) -//// two.lengt[|/*marker2*/|] - -// @filename: testLib/__init__.py -// @library: true -//// class ClassWithGetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ClassWithSetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// - -// @filename: testLib/__init__.pyi -// @library: true -//// class ClassWithGetterDocs(object): -//// @property -//// def length(self) -> int: -//// """ -//// read property doc -//// """ -//// ... -//// @length.setter -//// def length(self, value) -> None: ... -//// -//// class ClassWithSetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: -//// """ -//// setter property doc -//// """ -//// ... - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nread property doc', - }, - ], - }, - marker2: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nsetter property doc', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.keywords.expressionContext.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.keywords.expressionContext.fourslash.ts deleted file mode 100644 index df5c37aa..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.keywords.expressionContext.fourslash.ts +++ /dev/null @@ -1,99 +0,0 @@ -/// - -// Statement-only keywords (e.g. `raise`, `return`) should be suppressed in -// slots that can only contain an expression, while still being offered at the -// start of a statement. Expression-valid keywords (e.g. `lambda`) must keep -// appearing in expression slots. - -// @filename: stmtStart.py -//// def func(): -//// re[|/*stmtStart*/|] - -// @filename: forIterable.py -//// for item in ra[|/*forIterable*/|] - -// @filename: forIterableExprKeyword.py -//// for item in la[|/*forIterableExprKeyword*/|] - -// @filename: assignRhs.py -//// x = re[|/*assignRhs*/|] - -// @filename: assignRhsExprKeyword.py -//// x = la[|/*assignRhsExprKeyword*/|] - -// @filename: walrusRhs.py -//// if (n := re[|/*walrusRhs*/|]): -//// pass - -// @filename: comprehensionIterable.py -//// z = [i for i in re[|/*comprehensionIterable*/|]] - -// @filename: callArg.py -//// print(re[|/*callArg*/|]) - -// @filename: subscript.py -//// data = [1, 2] -//// w = data[re[|/*subscript*/|]] - -// @filename: returnValue.py -//// def func(): -//// return ra[|/*returnValue*/|] - -// @filename: whileCondition.py -//// while re[|/*whileCondition*/|]: -//// pass - -// @filename: ifCondition.py -//// if re[|/*ifCondition*/|]: -//// pass - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // Statement-only keywords are still offered at statement start, and - // expression-valid keywords are still offered in expression slots. - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - stmtStart: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - forIterableExprKeyword: { - completions: [{ label: 'lambda', kind: Consts.CompletionItemKind.Keyword }], - }, - assignRhsExprKeyword: { - completions: [{ label: 'lambda', kind: Consts.CompletionItemKind.Keyword }], - }, - }); - - // Statement-only keywords are suppressed in expression-only slots. - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - forIterable: { - completions: [{ label: 'raise', kind: Consts.CompletionItemKind.Keyword }], - }, - assignRhs: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - walrusRhs: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - comprehensionIterable: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - callArg: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - subscript: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - returnValue: { - completions: [{ label: 'raise', kind: Consts.CompletionItemKind.Keyword }], - }, - whileCondition: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - ifCondition: { - completions: [{ label: 'return', kind: Consts.CompletionItemKind.Keyword }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.keywords.pythonVersion.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.keywords.pythonVersion.fourslash.ts deleted file mode 100644 index 1b407d6b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.keywords.pythonVersion.fourslash.ts +++ /dev/null @@ -1,93 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "executionEnvironments": [ -//// { "root": "python33", "pythonVersion": "3.3" }, -//// { "root": "python35", "pythonVersion": "3.5" }, -//// { "root": "python310", "pythonVersion": "3.10" }, -//// { "root": "python315", "pythonVersion": "3.15" }, -//// ] -//// } - -// @filename: python33/test.py -//// def foo(): -//// [|/*python33*/|] - -// @filename: python35/test.py -//// def foo(): -//// [|/*python35*/|] - -// @filename: python310/test.py -//// def foo(): -//// [|/*python310*/|] - -// @filename: python315/test.py -//// def foo(): -//// [|/*python315*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - python33: { - completions: [ - { label: 'def', kind: Consts.CompletionItemKind.Keyword }, - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - python35: { - completions: [ - { label: 'def', kind: Consts.CompletionItemKind.Keyword }, - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - { label: 'async', kind: Consts.CompletionItemKind.Keyword }, - { label: 'await', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - python310: { - completions: [ - { label: 'def', kind: Consts.CompletionItemKind.Keyword }, - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - { label: 'async', kind: Consts.CompletionItemKind.Keyword }, - { label: 'await', kind: Consts.CompletionItemKind.Keyword }, - { label: 'case', kind: Consts.CompletionItemKind.Keyword }, - { label: 'match', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - python315: { - completions: [ - { label: 'def', kind: Consts.CompletionItemKind.Keyword }, - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - { label: 'async', kind: Consts.CompletionItemKind.Keyword }, - { label: 'await', kind: Consts.CompletionItemKind.Keyword }, - { label: 'case', kind: Consts.CompletionItemKind.Keyword }, - { label: 'match', kind: Consts.CompletionItemKind.Keyword }, - { label: 'lazy', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - python33: { - completions: [ - { label: 'async', kind: Consts.CompletionItemKind.Keyword }, - { label: 'await', kind: Consts.CompletionItemKind.Keyword }, - { label: 'case', kind: Consts.CompletionItemKind.Keyword }, - { label: 'match', kind: Consts.CompletionItemKind.Keyword }, - { label: 'lazy', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - python35: { - completions: [ - { label: 'case', kind: Consts.CompletionItemKind.Keyword }, - { label: 'match', kind: Consts.CompletionItemKind.Keyword }, - { label: 'lazy', kind: Consts.CompletionItemKind.Keyword }, - ], - }, - python310: { - completions: [{ label: 'lazy', kind: Consts.CompletionItemKind.Keyword }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.libCodeAndStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.libCodeAndStub.fourslash.ts deleted file mode 100644 index 9250c05a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.libCodeAndStub.fourslash.ts +++ /dev/null @@ -1,79 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.is[|/*marker2*/|] -//// obj.read[|/*marker3*/|] - -// @filename: testLib/__init__.py -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text): -//// '''Checks if the input string is valid.''' -//// return True -//// @property -//// def read_only_prop(self): -//// '''The read-only property.''' -//// return True -//// @property -//// def read_write_prop(self): -//// '''The read-write property.''' -//// return True -//// @read_write_prop.setter -//// def read_write_prop(self, val): -//// pass - -// @filename: testLib/__init__.pyi -// @library: true -//// class Validator: -//// def is_valid(self, text: str) -> bool: ... -//// @property -//// def read_only_prop(self) -> bool: ... -//// @property -//// def read_write_prop(self) -> bool: ... -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): ... - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'Validator', - kind: Consts.CompletionItemKind.Class, - documentation: '```python\nclass Validator()\n```\n---\nThe validator class', - }, - ], - }, - marker2: { - completions: [ - { - label: 'is_valid', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - }, - ], - }, - marker3: { - completions: [ - { - label: 'read_only_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_only_prop: bool (property)\n```\n---\nThe read-only property.', - }, - { - label: 'read_write_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_write_prop: bool (property)\n```\n---\nThe read-write property.', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.libCodeNoStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.libCodeNoStub.fourslash.ts deleted file mode 100644 index e986e40f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.libCodeNoStub.fourslash.ts +++ /dev/null @@ -1,69 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.is[|/*marker2*/|] -//// obj.read[|/*marker3*/|] - -// @filename: testLib/__init__.py -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// return True -//// @property -//// def read_only_prop(self) -> bool: -//// '''The read-only property.''' -//// return True -//// @property -//// def read_write_prop(self) -> bool: -//// '''The read-write property.''' -//// return True -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): -//// '''The read-write property.''' -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'Validator', - kind: Consts.CompletionItemKind.Class, - documentation: '```python\nclass Validator()\n```\n---\nThe validator class', - }, - ], - }, - marker2: { - completions: [ - { - label: 'is_valid', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - }, - ], - }, - marker3: { - completions: [ - { - label: 'read_only_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_only_prop: bool (property)\n```\n---\nThe read-only property.', - }, - { - label: 'read_write_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_write_prop: bool (property)\n```\n---\nThe read-write property.', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.libStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.libStub.fourslash.ts deleted file mode 100644 index 7cdc84b2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.libStub.fourslash.ts +++ /dev/null @@ -1,69 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.is[|/*marker2*/|] -//// obj.read[|/*marker3*/|] - -// @filename: testLib/__init__.pyi -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// pass -//// @property -//// def read_only_prop(self) -> bool: -//// '''The read-only property.''' -//// pass -//// @property -//// def read_write_prop(self) -> bool: -//// '''The read-write property.''' -//// pass -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): -//// '''The read-write property.''' -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'Validator', - kind: Consts.CompletionItemKind.Class, - documentation: '```python\nclass Validator()\n```\n---\nThe validator class', - }, - ], - }, - marker2: { - completions: [ - { - label: 'is_valid', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - }, - ], - }, - marker3: { - completions: [ - { - label: 'read_only_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_only_prop: bool (property)\n```\n---\nThe read-only property.', - }, - { - label: 'read_write_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_write_prop: bool (property)\n```\n---\nThe read-write property.', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.literals.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.literals.fourslash.ts deleted file mode 100644 index 9e066b9d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.literals.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: test1.py -//// from typing import Literal -//// a: Literal["Hello"] = "He[|/*marker1*/|] - -// @filename: test2.py -//// from typing import Literal -//// a: Literal["Hello"] = [|/*marker2*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: '"Hello"', - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - marker2: { - completions: [ - { - label: '"Hello"', - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.localCode.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.localCode.fourslash.ts deleted file mode 100644 index aac61c6a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.localCode.fourslash.ts +++ /dev/null @@ -1,74 +0,0 @@ -/// - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.is[|/*marker2*/|] -//// obj.read[|/*marker3*/|] -//// testLib.Validator.is[|/*marker4*/|] - -// @filename: testLib/__init__.py -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// return True -//// @property -//// def read_only_prop(self) -> bool: -//// '''The read-only property.''' -//// return True -//// @property -//// def read_write_prop(self) -> bool: -//// '''The read-write property.''' -//// return True -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): -//// '''The read-write property.''' -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'Validator', - kind: Consts.CompletionItemKind.Class, - documentation: '```python\nclass Validator()\n```\n---\nThe validator class', - }, - ], - }, - marker2: { - completions: [ - { - label: 'is_valid', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - }, - ], - }, - marker3: { - completions: [ - { - label: 'read_only_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_only_prop: bool (property)\n```\n---\nThe read-only property.', - }, - { - label: 'read_write_prop', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nread_write_prop: bool (property)\n```\n---\nThe read-write property.', - }, - ], - }, - marker4: { - completions: [ - { - label: 'is_valid', - kind: Consts.CompletionItemKind.Method, - documentation: - '```python\ndef is_valid(self: Validator, text: str) -> bool\n```\n---\nChecks if the input string is valid.', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.ts deleted file mode 100644 index 8758eda6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @filename: test.py -//// class Model: -//// pass -//// -//// def some_func1(a: Model): -//// x = a.unknownName.[|/*marker1*/|] -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [], - memberAccessInfo: { lastKnownModule: 'test', lastKnownMemberName: 'Model', unknownMemberName: 'unknownName' }, - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.ts deleted file mode 100644 index 6545229c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// - -// @filename: test.py -//// class Model: -//// @staticmethod -//// def foo( value ): -//// return value -//// -//// -//// x = Model.foo(unknownValue).[|/*marker1*/|] -//// pass -//// -//// y = Model.unknownMember.[|/*marker2*/|] -//// pass -//// -//// def some_func1(a: Model): -//// x = a.unknownMember.[|/*marker3*/|] -//// pass -//// -//// Model.unknownValue.[|/*marker4*/|] -//// -//// UnkownModel.unknownValue.[|/*marker5*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - // tests: _getLastKnownModule(): if (curNode.nodeType === ParseNodeType.MemberAccess && curNode.memberName) - marker1: { - completions: [], - memberAccessInfo: { lastKnownModule: 'test', lastKnownMemberName: 'foo', unknownMemberName: 'foo' }, - }, - // tests: _getLastKnownModule(): else if (curNode.nodeType === ParseNodeType.Name && isClassAndInstantiable(curType)) - marker2: { - completions: [], - memberAccessInfo: { - lastKnownModule: 'test', - lastKnownMemberName: 'Model', - unknownMemberName: 'unknownMember', - }, - }, - // tests: _getLastKnownModule(): else if (curNode.nodeType === ParseNodeType.Name && isObject(curType)) - marker3: { - completions: [], - memberAccessInfo: { - lastKnownModule: 'test', - lastKnownMemberName: 'Model', - unknownMemberName: 'unknownMember', - }, - }, - marker4: { - completions: [], - memberAccessInfo: { lastKnownModule: 'test', lastKnownMemberName: 'Model', unknownMemberName: 'unknownValue' }, - }, - marker5: { - completions: [], - memberAccessInfo: {}, - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.ts deleted file mode 100644 index a280754c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testnumpy -//// obj = testnumpy.random.randint("foo").[|/*marker1*/|] - -// @filename: testnumpy/__init__.py -// @library: true -//// from . import random - -// @filename: testnumpy/random/__init__.py -// @library: true -//// __all__ = ['randint'] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [], - memberAccessInfo: { - lastKnownModule: 'testnumpy.random', - lastKnownMemberName: 'random', - unknownMemberName: 'randint', - }, - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.overloads.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.overloads.fourslash.ts deleted file mode 100644 index a2e95ede..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.overloads.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @filename: overloads_client.py -//// import overloads -//// overloads.f[|/*marker1*/|] - -// @filename: typings/overloads.pyi -//// from typing import overload -//// -//// @overload -//// def func(x: str) -> str: ...[|/*marker2*/|] -//// -//// @overload -//// def func(x: bytes) -> bytes: -//// ...[|/*marker3*/|] -//// -//// @overload -//// def func(x: int) -> int: -//// '''func docs''' -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'func', - kind: Consts.CompletionItemKind.Function, - documentation: - '```python\ndef func(x: str) -> str: ...\ndef func(x: bytes) -> bytes: ...\ndef func(x: int) -> int: ...\n```\n---\nfunc docs', - }, - ], - }, -}); - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker2: { completions: [] }, - marker3: { completions: [] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.default.fourslash.ts deleted file mode 100644 index dc9fb1fb..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// - -// @filename: test.py -//// class B: -//// def method1(self, a: str = 'hello', b: int = 1234): -//// pass -//// -//// def method2(self, a=None): -//// pass -//// -//// def method3(self, a=1234, b=object()): -//// pass -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: "method1(self, a: str = 'hello', b: int = 1234):\n return super().method1(a, b)", - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, a=None):\n return super().method2(a)', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, a=1234, b=object()):\n return super().method3(a, b)', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.importStub.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.default.importStub.ts deleted file mode 100644 index 149520ca..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.importStub.ts +++ /dev/null @@ -1,50 +0,0 @@ -/// - -// @filename: main.py -//// from test import B -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @filename: test.pyi -//// class B: -//// def method1(self, a: str = 'hello', b: int = 1234): -//// pass -//// -//// def method2(self, a=None): -//// pass -//// -//// def method3(self, a=1234, b=object()): -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method1(self, a: str = ..., b: int = ...):\n return super().method1(a=a, b=b)', - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, a=...):\n return super().method2(a=a)', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, a=..., b=...):\n return super().method3(a=a, b=b)', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.imported.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.default.imported.fourslash.ts deleted file mode 100644 index b79d11c7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.imported.fourslash.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// - -// @filename: test.py -//// from foo import B -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @filename: foo.py -//// class B: -//// def method1(self, a: str = 'hello', b: int = 1234): -//// pass -//// -//// def method2(self, a=None): -//// pass -//// -//// def method3(self, a=1234, b=object()): -//// pass -//// -//// def method4(self, a=+1234, b=-1.23j, c=1+2j): -//// pass - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: "method1(self, a: str = 'hello', b: int = 1234):\n return super().method1(a, b)", - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, a=None):\n return super().method2(a)', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, a=1234, b=...):\n return super().method3(a, b)', - }, - }, - { - label: 'method4', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method4(self, a=+1234, b=-1.23j, c=1 + 2j):\n return super().method4(a, b, c)', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.stub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.default.stub.fourslash.ts deleted file mode 100644 index 227dee7a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.default.stub.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// - -// @filename: test.pyi -//// class B: -//// def method1(self, a: str = 'hello', b: int = 1234): -//// pass -//// -//// def method2(self, a=None): -//// pass -//// -//// def method3(self, a=1234, b=object()): -//// pass -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method1(self, a: str = ..., b: int = ...): ...', - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, a=...): ...', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, a=..., b=...): ...', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.fourslash.ts deleted file mode 100644 index a7347ca6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// - -// @filename: test.py -//// class B: -//// def method1(self, a: str, *args, **kwargs): -//// pass -//// -//// def method2(self, b, /, *args): -//// pass -//// -//// def method3(self, b, *, c: str): -//// pass -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method1(self, a: str, *args, **kwargs):\n return super().method1(a, *args, **kwargs)', - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, b, /, *args):\n return super().method2(b, *args)', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, b, *, c: str):\n return super().method3(b, c=c)', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.property.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.property.fourslash.ts deleted file mode 100644 index 09b92c93..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.property.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test.py -//// class B: -//// @property -//// def prop(self): -//// return 1 -//// -//// @prop.setter -//// def prop(self, value): -//// pass -//// -//// class C(B): -//// @property -//// def [|pr/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'prop', - kind: Consts.CompletionItemKind.Property, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'prop(self):\n return super().prop', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.property.stub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.property.stub.fourslash.ts deleted file mode 100644 index c8370e8a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.property.stub.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test.pyi -//// class B: -//// @property -//// def prop(self): -//// return 1 -//// -//// @prop.setter -//// def prop(self, value): -//// pass -//// -//// class C(B): -//// @property -//// def [|pr/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'prop', - kind: Consts.CompletionItemKind.Property, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'prop(self): ...', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.staticAndClassmethod.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.staticAndClassmethod.fourslash.ts deleted file mode 100644 index 33f75d78..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.staticAndClassmethod.fourslash.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// - -// @filename: test.py -//// class A: -//// @staticmethod -//// def smethod(a, b): -//// pass -//// -//// @classmethod -//// def cmethod(cls, a): -//// pass -//// -//// class B1(A): -//// def [|m/*marker1*/|] -//// -//// class B2(A): -//// @staticmethod -//// def [|m/*marker2*/|] -//// -//// class B3(A): -//// @classmethod -//// def [|m/*marker3*/|] - -{ - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker2: { - completions: [ - { - label: 'smethod', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker2'), - newText: 'smethod(a, b):\n return super().smethod(a, b)', - }, - }, - ], - }, - marker3: { - completions: [ - { - label: 'cmethod', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker3'), - newText: 'cmethod(cls, a):\n return super().cmethod(a)', - }, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker1: { - completions: [ - { label: 'smethod', kind: undefined }, - { label: 'cmethod', kind: undefined }, - ], - }, - marker2: { completions: [{ label: 'cmethod', kind: undefined }] }, - marker3: { completions: [{ label: 'smethod', kind: undefined }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override.stub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override.stub.fourslash.ts deleted file mode 100644 index 63818a78..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override.stub.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// - -// @filename: test.pyi -//// class B: -//// def method1(self, a: str, *args, **kwargs): -//// pass -//// -//// def method2(self, b, /, *args): -//// pass -//// -//// def method3(self, b, *, c: str): -//// pass -//// -//// class C(B): -//// def [|method/*marker*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method1(self, a: str, *args, **kwargs): ...', - }, - }, - { - label: 'method2', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method2(self, b, /, *args): ...', - }, - }, - { - label: 'method3', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'method3(self, b, *, c: str): ...', - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.override2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.override2.fourslash.ts deleted file mode 100644 index 9014b960..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.override2.fourslash.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// - -// @filename: test.py -//// class B(list): -//// def [|append/*marker*/|] - -// @filename: test1.py -//// class A: -//// def __init__(self, *args, **kwargs): -//// pass -//// -//// class B(A): -//// def [|__init__/*marker1*/|] - -// @filename: test2.py -//// class A: -//// def [|__class__/*marker2*/|] - -// @filename: test3.py -//// class A: -//// def [|__call__/*marker3*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'append', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker'), - newText: 'append(self, object: _T, /) -> None:\n return super().append(object)', - }, - }, - ], - }, - marker1: { - completions: [ - { - label: '__init__', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker1'), - newText: '__init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)', - }, - }, - ], - }, - marker3: { - completions: [ - { - label: '__call__', - kind: Consts.CompletionItemKind.Method, - textEdit: { - range: helper.getPositionRange('marker3'), - newText: '__call__(self, *args: Any, **kwds: Any) -> Any:\n ${0:pass}', - }, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - // Only method shows up. __class__ is property - marker2: { completions: [{ label: '__class__', kind: undefined }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.parameters.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.parameters.fourslash.ts deleted file mode 100644 index 21a910f3..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.parameters.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -// @filename: test.py -//// def Method(a, b, c): -//// pass -//// -//// Method([|/*marker1*/|]"[|/*marker2*/|]hello[|/*marker3*/|]"[|/*marker4*/|]) - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [{ label: 'a=', kind: Consts.CompletionItemKind.Variable }], - }, - marker4: { - completions: [{ label: 'b=', kind: Consts.CompletionItemKind.Variable }], - }, -}); - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker2: { completions: [] }, - marker3: { completions: [] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.params.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.params.fourslash.ts deleted file mode 100644 index db77a8a0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.params.fourslash.ts +++ /dev/null @@ -1,72 +0,0 @@ -/// - -// @filename: test.py -//// from typing import TypedDict, Unpack, Any -//// -//// class Movie(TypedDict): -//// key1: str -//// key2: int -//// -//// def method(param1=None, param2='active', param3=None): -//// pass -//// -//// met/*marker1*/hod /*marker2*/ ( /*marker3*/ param2 = 'test') -//// -//// def method2(param1: int, **kwargs: Unpack[Movie]): -//// pass -//// -//// method2(p/*marker4*/, k/*marker5*/) -//// -//// def method3(param1: int, **kwargs: Any): -//// pass -//// -//// method3(p/*marker6*/, k/*marker7*/) -//// -//// def method4(param1: int, /, param2: int): -//// pass -//// -//// method4(p/*marker8*/) - -// @ts-ignore -await helper.verifyCompletion('excluded', 'markdown', { - marker1: { - completions: [{ label: 'param1', kind: undefined }], - }, - marker2: { - completions: [{ label: 'param1', kind: undefined }], - }, - marker4: { - completions: [{ label: 'key1', kind: undefined }], - }, - marker5: { - completions: [{ label: 'param1', kind: undefined }], - }, - marker7: { - completions: [{ label: 'key1', kind: undefined }], - }, - marker8: { - completions: [{ label: 'param1', kind: undefined }], - }, -}); - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker3: { - completions: [{ label: 'param1=', kind: Consts.CompletionItemKind.Variable }], - }, - marker4: { - completions: [{ label: 'param1=', kind: Consts.CompletionItemKind.Variable }], - }, - marker5: { - completions: [ - { label: 'key2=', kind: Consts.CompletionItemKind.Variable }, - { label: 'key1=', kind: Consts.CompletionItemKind.Variable }, - ], - }, - marker6: { - completions: [{ label: 'param1=', kind: Consts.CompletionItemKind.Variable }], - }, - marker8: { - completions: [{ label: 'param2=', kind: Consts.CompletionItemKind.Variable }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.parentFolder.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.parentFolder.fourslash.ts deleted file mode 100644 index 53ca2dcf..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.parentFolder.fourslash.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @filename: python/test.py -//// from d/*marker*/ - -// @filename: python/data_processing/__init__.py -//// #empty - -// @filename: python/data_processing/create_fullname.py -//// #empty - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [{ label: 'data_processing', kind: Consts.CompletionItemKind.Module }], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.parentFolders.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.parentFolders.fourslash.ts deleted file mode 100644 index 546bf6fe..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.parentFolders.fourslash.ts +++ /dev/null @@ -1,77 +0,0 @@ -/// - -// @filename: module.py -//// # empty - -// @filename: nested1/__init__.py -//// # empty - -// @filename: nested1/module.py -//// # empty - -// @filename: nested1/nested2/__init__.py -//// # empty - -// @filename: nested1/nested2/test1.py -//// from .[|/*marker1*/|] - -// @filename: nested1/nested2/test2.py -//// from ..[|/*marker2*/|] - -// @filename: nested1/nested2/test3.py -//// from ..nested2.[|/*marker3*/|] - -// @filename: nested1/nested2/test4.py -//// from ...nested1.[|/*marker4*/|] - -// @filename: nested1/nested2/test5.py -//// from ...nested1.nested2.[|/*marker5*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - { label: 'test1', kind: Consts.CompletionItemKind.Module }, - { label: 'test2', kind: Consts.CompletionItemKind.Module }, - { label: 'test3', kind: Consts.CompletionItemKind.Module }, - { label: 'test4', kind: Consts.CompletionItemKind.Module }, - { label: 'test5', kind: Consts.CompletionItemKind.Module }, - ], - }, - marker2: { - completions: [ - { label: 'import', kind: Consts.CompletionItemKind.Keyword }, - { label: 'nested2', kind: Consts.CompletionItemKind.Module }, - { label: 'module', kind: Consts.CompletionItemKind.Module }, - ], - }, - marker3: { - completions: [ - { label: 'test1', kind: Consts.CompletionItemKind.Module }, - { label: 'test2', kind: Consts.CompletionItemKind.Module }, - { label: 'test3', kind: Consts.CompletionItemKind.Module }, - { label: 'test4', kind: Consts.CompletionItemKind.Module }, - { label: 'test5', kind: Consts.CompletionItemKind.Module }, - ], - }, - marker4: { - completions: [ - { label: 'nested2', kind: Consts.CompletionItemKind.Module }, - { label: 'module', kind: Consts.CompletionItemKind.Module }, - ], - }, - marker5: { - completions: [ - { label: 'test1', kind: Consts.CompletionItemKind.Module }, - { label: 'test2', kind: Consts.CompletionItemKind.Module }, - { label: 'test3', kind: Consts.CompletionItemKind.Module }, - { label: 'test4', kind: Consts.CompletionItemKind.Module }, - { label: 'test5', kind: Consts.CompletionItemKind.Module }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.plainText.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.plainText.fourslash.ts deleted file mode 100644 index 57c810a4..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.plainText.fourslash.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// - -// @filename: test.py -//// import time -//// time.gmt[|/*marker1*/|] -//// aaaaaa = 100 -//// aaaaa[|/*marker2*/|] -//// def some_func1(a): -//// '''some function docs''' -//// pass -//// def some_func2(a): -//// '''another function docs''' -//// pass -//// some_fun[|/*marker3*/|] - -// @ts-ignore -await helper.verifyCompletion('exact', 'plaintext', { - marker1: { completions: [{ label: 'gmtime', kind: Consts.CompletionItemKind.Function }] }, - marker2: { completions: [{ label: 'aaaaaa', kind: Consts.CompletionItemKind.Variable }] }, - marker3: { - completions: [ - { - label: 'some_func1', - kind: Consts.CompletionItemKind.Function, - documentation: 'def some_func1(a: Unknown) -> None\n\nsome function docs', - }, - { - label: 'some_func2', - kind: Consts.CompletionItemKind.Function, - documentation: 'def some_func2(a: Unknown) -> None\n\nanother function docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.private.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.private.fourslash.ts deleted file mode 100644 index fed9c62b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.private.fourslash.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// - -// @filename: test1.py -//// def __hello(): -//// pass -//// -//// __hello[|/*marker1*/|] - -// @filename: test2.pyi -//// from typing import Union -//// -//// Union[|/*marker2*/|] -//// -//// def __hello1(): -//// pass -//// -//// __hello1[|/*marker3*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - // Private symbol in same file suggested. - { - label: '__hello', - kind: Consts.CompletionItemKind.Function, - }, - ], - }, - marker2: { - completions: [ - // No Auto-import on Union exists. - { - label: 'Union', - kind: Consts.CompletionItemKind.Class, - }, - ], - }, - marker3: { - completions: [ - { - label: '__hello1', - kind: Consts.CompletionItemKind.Function, - }, - ], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker3: { - completions: [ - // Private symbol from other file not suggested. - { - label: '__hello', - kind: Consts.CompletionItemKind.Function, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.property.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.property.fourslash.ts deleted file mode 100644 index b317ba27..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.property.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: test.py -//// class C: -//// def __init__(self): -//// self._x = None -//// -//// @property -//// def prop(self): -//// pass -//// -//// @prop.setter -//// def prop(self, value): -//// pass -//// -//// C()./*marker*/prop - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { - completions: [ - { - label: 'prop', - kind: Consts.CompletionItemKind.Property, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.propertyDocStrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.propertyDocStrings.fourslash.ts deleted file mode 100644 index a926b8fb..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.propertyDocStrings.fourslash.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// class ClassWithGetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// """ -//// read property doc -//// """ -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// one = ClassWithGetterDocs(3) -//// one.lengt[|/*marker1*/|] -//// -//// class ClassWithSetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// """ -//// setter property doc -//// """ -//// pass -//// -//// two = ClassWithSetterDocs(3) -//// two.lengt[|/*marker2*/|] -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nread property doc', - }, - ], - }, - marker2: { - completions: [ - { - label: 'length', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nlength: Unknown (property)\n```\n---\nsetter property doc', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.qualname.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.qualname.fourslash.ts deleted file mode 100644 index 25c6f0a0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.qualname.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// @filename: test.py -//// class A: -//// pass -//// -//// a = A() -//// a.__[|/*instanceMarker*/|] -//// A.__[|/*classMarker*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // `__qualname__` is exposed via the metaclass (`type`), so it is a valid - // member of the class object but not of an instance. - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - instanceMarker: { - completions: [{ label: '__qualname__', kind: Consts.CompletionItemKind.Variable }], - }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - instanceMarker: { - completions: [ - { label: '__doc__', kind: Consts.CompletionItemKind.Variable }, - { label: '__module__', kind: Consts.CompletionItemKind.Variable }, - ], - }, - classMarker: { - completions: [{ label: '__qualname__', kind: Consts.CompletionItemKind.Variable }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.self.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.self.fourslash.ts deleted file mode 100644 index 935b7665..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.self.fourslash.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// - -// @filename: test.py -//// class Foo: -//// def __init__(self): -//// self.var1 = 3 -//// def method1(self): -//// '''Method 1.''' -//// pass -//// @property -//// def prop1(self): -//// '''Property 1.''' -//// return 2 -//// def new_method(self): -//// self.[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - documentation: '```python\ndef method1() -> None\n```\n---\nMethod 1.', - }, - { - label: 'new_method', - kind: Consts.CompletionItemKind.Method, - documentation: '```python\ndef new_method() -> None\n```', - }, - { - label: 'prop1', - kind: Consts.CompletionItemKind.Property, - documentation: '```python\nprop1: Literal[2] (property)\n```\n---\nProperty 1.', - }, - { - label: 'var1', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nvar1: int\n```', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.escape.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.escape.fourslash.ts deleted file mode 100644 index 64f33dca..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.escape.fourslash.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// - -// @filename: test.py -//// from typing import Literal -//// -//// def method(foo: Literal["'\"", '"\'', "'mixed'"]): -//// pass -//// -//// method([|/*marker1*/|]) -//// method([|"/*marker2*/"|]) -//// method([|'/*marker3*/'|]) - -{ - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: '"\'\\""', - kind: Consts.CompletionItemKind.Constant, - }, - { - label: '"\\"\'"', - kind: Consts.CompletionItemKind.Constant, - }, - { - label: '"\'mixed\'"', - kind: Consts.CompletionItemKind.Constant, - }, - ], - }, - marker2: { - completions: [ - { - label: '"\'\\""', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"\'\\""' }, - }, - { - label: '"\\"\'"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"\\"\'"' }, - }, - { - label: '"\'mixed\'"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker2'), newText: '"\'mixed\'"' }, - }, - ], - }, - marker3: { - completions: [ - { - label: "'\\'\"'", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: "'\\'\"'" }, - }, - { - label: "'\"\\''", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: "'\"\\''" }, - }, - { - label: "'\\'mixed\\''", - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: helper.getPositionRange('marker3'), newText: "'\\'mixed\\''" }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.fourslash.ts deleted file mode 100644 index 183a7256..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.stringLiteral.fourslash.ts +++ /dev/null @@ -1,79 +0,0 @@ -/// - -// @filename: test.py -//// import os -//// from typing import Literal, TypedDict, Union -//// -//// def method(a, b, c): -//// pass -//// -//// method("os.[|/*marker1*/|]") -//// -//// class Movie(TypedDict): -//// name: str -//// age: int -//// -//// m = Movie(name="hello", age=10) -//// m[[|"/*marker2*/"|]] -//// -//// a: Union[Literal["hello"], Literal["hallo"]] -//// a = [|"/*marker3*/"|] -//// -//// class Nested(TypedDict): -//// movie: Movie -//// -//// n: Nested = {"movie": {"name": "hello", "age": 10}} -//// n["movie"][[|/*marker4*/|]] - -{ - const marker2Range = helper.getPositionRange('marker2'); - const marker3Range = helper.getPositionRange('marker3'); - const marker4Range = helper.getPositionRange('marker4'); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { - completions: [ - { - label: '"name"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker2Range, newText: '"name"' }, - }, - { - label: '"age"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker2Range, newText: '"age"' }, - }, - ], - }, - marker3: { - completions: [ - { - label: '"hello"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: '"hello"' }, - }, - { - label: '"hallo"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker3Range, newText: '"hallo"' }, - }, - ], - }, - marker4: { - completions: [ - { - label: '"name"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: '"name"' }, - }, - { - label: '"age"', - kind: Consts.CompletionItemKind.Constant, - textEdit: { range: marker4Range, newText: '"age"' }, - }, - ], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.triggers.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.triggers.fourslash.ts deleted file mode 100644 index ddf05e1b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.triggers.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// @filename: test1.py -//// .[|/*marker1*/|] - -// @filename: test2.py -//// ..[|/*marker2*/|] - -// @filename: test3.py -//// ...[|/*marker3*/|] - -// @filename: test4.py -//// ....[|/*marker4*/|] - -// @filename: test5.py -//// dict = { "test" : "value" } -//// dict[.[|/*marker5*/|]] - -// @filename: test6.py -//// a = 1 -//// a..[|/*marker6*/|] - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, - marker4: { completions: [] }, - marker5: { completions: [] }, - marker6: { completions: [] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.typeAlias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.typeAlias.fourslash.ts deleted file mode 100644 index 219750fd..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.typeAlias.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: test.py -//// AliasT = list[int] -//// x: AliasT[|/*marker1*/|] -//// y: AliasT = [] -//// y[|/*marker2*/|] - -// @ts-ignore -await helper.verifyCompletion('includes', 'markdown', { - marker1: { - completions: [ - { - label: 'AliasT', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nAliasT: type[list[int]]\n```', - }, - ], - }, - marker2: { - completions: [ - { - label: 'y', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\ny: AliasT\n```', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.typeshed.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.typeshed.fourslash.ts deleted file mode 100644 index 24c34c5d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.typeshed.fourslash.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -// @filename: test.py -//// from r/*marker*/ - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker: { completions: [{ label: 'requests', kind: Consts.CompletionItemKind.Module }] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.vardecls.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.vardecls.fourslash.ts deleted file mode 100644 index 62ae93da..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.vardecls.fourslash.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// - -// @filename: test1.py -//// a/*marker1*/ = 1 - -// @filename: test2.py -//// a = 1 -//// a/*marker2*/ = 1 - -// @filename: test3.py -//// if (a/*marker3*/:= 1): pass - -// @filename: test4.py -//// a = 1 -//// if (a/*marker4*/:= 1): pass - -// @filename: test5.py -//// a = 1 -//// a/*marker5*/ *= 1 - -// @filename: test6.py -//// a = 1 -//// a/*marker6*/ *= 1 - -{ - helper.openFiles(helper.getMarkers().map((m) => m.fileName)); - - // @ts-ignore - await helper.verifyCompletion('excluded', 'markdown', { - marker1: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - marker3: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - }); - - // @ts-ignore - await helper.verifyCompletion('included', 'markdown', { - marker2: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - marker4: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - marker5: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - marker6: { completions: [{ label: 'a', kind: Consts.CompletionItemKind.Variable }] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.variableDocStrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.variableDocStrings.fourslash.ts deleted file mode 100644 index e3ee2891..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.variableDocStrings.fourslash.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// - -// @filename: test.py -//// from typing import List, Union, Callable -//// -//// class Foo: -//// """ This is a docstring """ -//// -//// aaa = 4 -//// """ aaa is an int """ -//// -//// def __init__(self, func : Callable[[float], float]) -> None: -//// self.bbb = "hi" -//// " bbb is a str " -//// self.func = func -//// """A given function""" -//// -//// ccc = Foo() -//// """ ccc is a Foo """ -//// -//// SomeType = List[Union[int, str]] -//// """Here's some documentation about SomeType""" -//// -//// foo1.b[|/*marker1*/|] -//// -//// foo1.a[|/*marker2*/|] -//// -//// cc[|/*marker3*/|] -//// -//// SomeType[|/*marker4*/|] -//// -//// ccc.fun[|/*marker5*/|] - -// @ts-ignore -await helper.verifyCompletion('includes', 'markdown', { - marker1: { - completions: [ - { - label: 'bbb', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nbbb: str\n```\n---\nbbb is a str', - }, - ], - }, - marker2: { - completions: [ - { - label: 'aaa', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\naaa: int\n```\n---\naaa is an int', - }, - ], - }, - marker3: { - completions: [ - { - label: 'ccc', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nccc: Foo\n```\n---\nccc is a Foo', - }, - ], - }, - marker4: { - completions: [ - { - label: 'SomeType', - kind: Consts.CompletionItemKind.Variable, - documentation: - "```python\nSomeType: type[List[int | str]]\n```\n---\nHere's some documentation about SomeType", - }, - ], - }, - marker5: { - completions: [ - { - label: 'func', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\ndef func(float) -> float\n```\n---\nA given function', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.wildcardimports.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.wildcardimports.fourslash.ts deleted file mode 100644 index 147a4e30..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.wildcardimports.fourslash.ts +++ /dev/null @@ -1,121 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: lib1/definition.py -// @library: true -//// def func(): -//// '''func docs''' -//// pass -//// -//// class MyType: -//// def func2(self): -//// '''func2 docs''' -//// pass - -// @filename: lib1/alias.py -// @library: true -//// def func3(): -//// '''func3 docs''' -//// pass - -// @filename: lib1/withall.py -// @library: true -//// def func4(): -//// '''func4 docs''' -//// pass -//// -//// def func5(): -//// '''func5 docs''' -//// pass -//// -//// __all__ = ['func5'] - -// @filename: lib1/redirect.py -// @library: true -//// from . import withall -//// from .withall import * -//// -//// __all__ += withall.__all__ - -// @filename: lib1/wildcard.py -// @library: true -//// from .definition import * -//// from .redirect import * -//// from .alias import func3 - -// @filename: lib1/__init__.py -// @library: true -//// from .wildcard import * - -// @filename: lib1/__init__.pyi -// @library: true -//// class ufunc: -//// def __call__(self): ... -//// -//// func: ufunc -//// class MyType: -//// def func2(self) -> None : ... -//// func3: ufunc -//// func4: ufunc -//// func5: ufunc - -// @filename: test.py -//// import lib1 -//// lib1.[|/*marker1*/func|]() -//// lib1.MyType().[|/*marker2*/func2|]() -//// lib1.[|/*marker3*/func3|]() -//// lib1.[|/*marker4*/func4|]() -//// lib1.[|/*marker5*/func5|]() - -// @ts-ignore -await helper.verifyCompletion('includes', 'markdown', { - marker1: { - completions: [ - { - label: 'func', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nfunc: ufunc\n```\n---\nfunc docs', - }, - ], - }, - marker2: { - completions: [ - { - label: 'func2', - kind: Consts.CompletionItemKind.Method, - documentation: '```python\ndef func2() -> None\n```\n---\nfunc2 docs', - }, - ], - }, - marker3: { - completions: [ - { - label: 'func3', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nfunc3: ufunc\n```\n---\nfunc3 docs', - }, - ], - }, - marker4: { - completions: [ - { - label: 'func4', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nfunc4: ufunc\n```\n---\nfunc4 docs', - }, - ], - }, - marker5: { - completions: [ - { - label: 'func5', - kind: Consts.CompletionItemKind.Variable, - documentation: '```python\nfunc5: ufunc\n```\n---\nfunc5 docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/completions.with.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/completions.with.fourslash.ts deleted file mode 100644 index c0acd488..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/completions.with.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: test.py -//// from unittest.mock import patch -//// def some_func(): -//// pass -//// with patch('some_func') as[|/*marker1*/|] a1: -//// pass -//// with patch('some_func') as [|/*marker2*/|] a1: -//// pass -//// with patch('some_func') as a[|/*marker3*/|]2: -//// pass -//// with patch[|/*marker4*/|]('some_func'): -//// pass - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { completions: [] }, - marker2: { completions: [] }, - marker3: { completions: [] }, -}); - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker4: { completions: [{ label: 'patch', kind: Consts.CompletionItemKind.Variable }] }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.compiledModule.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.compiledModule.fourslash.ts deleted file mode 100644 index 4dce7b34..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.compiledModule.fourslash.ts +++ /dev/null @@ -1,133 +0,0 @@ -/// - -// A package shipped as a "sourceless distribution": a compiled `.pyc` module sits -// where the `.py` source would be (directly beside its `.pyi` stub, NOT under -// `__pycache__`), with no `.py` file. Python imports such a `.pyc` directly, so the -// module exists at runtime even though it has no Python source. The -// `reportMissingModuleSource` warning ("could not be resolved from source") is -// therefore misleading and should NOT fire. -// -// This mirrors the native-extension case (a `.pyd`/`.so` backing a `.pyi` stub): -// a compiled implementation with no Python source is still a real runtime module. - -// --- Top-level compiled module: `mod.pyc` beside `mod.pyi`, no `mod.py`. --- -// @filename: compiledmod.pyi -// @library: true -//// VALUE: int - -// @filename: compiledmod.pyc -// @library: true -//// # Compiled bytecode placeholder. Only the file's presence matters to import -//// # resolution; the text content is never parsed. - -// --- Compiled package + compiled submodule: `__init__.pyc`/`sub.pyc` beside the -// stubs, no `.py` anywhere. Exercises the package (`__init__`) layout and the -// dotted/submodule resolution paths. -// -// Note: `import compiledpkg` itself does NOT exercise the new `.pyc` branch -- -// the non-stub pass resolves the package via the pre-existing namespace-package -// directory fallback (`foundDirectory` -> `isImportFound`), and `__init__.pyc` -// is never probed. The genuinely new-branch cases are the top-level -// `compiledmod` and the submodule `compiledpkg.sub` (dotted + `from ... import`). --- -// @filename: compiledpkg/__init__.pyi -// @library: true -//// PKGVALUE: int - -// @filename: compiledpkg/__init__.pyc -// @library: true -//// # Compiled bytecode placeholder for the package __init__. - -// @filename: compiledpkg/sub.pyi -// @library: true -//// SUBVALUE: int - -// @filename: compiledpkg/sub.pyc -// @library: true -//// # Compiled bytecode placeholder for the submodule. - -// --- Compiled module WITHOUT a stub (`.pyc` only, no `.pyi`/`.py`). The `.pyc` -// branch is gated on `!allowPyi`, so the stub (primary) resolution must still -// fail here and `reportMissingImports` must fire. Regression guard. --- -// @filename: pyconlymod.pyc -// @library: true -//// # Compiled bytecode placeholder; there is no stub for this module. - -// --- `isLastPart` gate guard: a `.pyc` at a NON-leaf (mid-path) position must NOT -// partially resolve a dotted import. `midpathmod.pyc` exists but there is no -// `midpathmod/` package directory, so `import midpathmod.sub` must still fail -// with reportMissingImports. The new branch is gated on `isLastPart`, so a -// mid-path `.pyc` can never satisfy a non-leaf component. --- -// @filename: midpathmod.pyc -// @library: true -//// # Compiled bytecode placeholder at a mid-path position; no package directory. - -// --- Stub-only controls (no `.pyc`, no `.py`): `reportMissingModuleSource` MUST -// still fire for both a top-level module and a submodule. --- -// @filename: stubonlymod.pyi -// @library: true -//// HELPER: int - -// @filename: stubonlypkg/__init__.pyi -// @library: true -//// # Stub-only package (control). - -// @filename: stubonlypkg/missing.pyi -// @library: true -//// def helper() -> int: ... - -// @filename: test.py -//// # Compiled `.pyc` sits beside the `.pyi` stub (no `.py`) -> NO warning. -//// from compiledmod import VALUE -//// import compiledmod -//// -//// # Compiled package (`__init__.pyc` beside `__init__.pyi`, no `__init__.py`) -> NO warning. -//// import compiledpkg -//// from compiledpkg import PKGVALUE -//// -//// # Compiled submodule, dotted (visitModuleName path) -> NO warning. -//// import compiledpkg.sub -//// from compiledpkg.sub import SUBVALUE -//// -//// # Compiled submodule imported as a name (visitImportFromAs submoduleFallback) -> NO warning. -//// from compiledpkg import sub -//// -//// # `.pyc` only, no stub: primary (stub) resolution must still fail -> reportMissingImports. -//// import [|/*markerMissing*/pyconlymod|] -//// -//// # Mid-path `.pyc` (no package directory): dotted import must still fail (isLastPart gate). -//// import [|/*markerMidpath*/midpathmod.sub|] -//// -//// # Stub-only module (no `.pyc`, no `.py`) -> warning MUST still fire (control). -//// from [|/*marker1*/stubonlymod|] import HELPER -//// import [|/*marker2*/stubonlymod|] -//// -//// # Stub-only submodule (no `.pyc`, no `.py`) -> warning MUST still fire (control). -//// from [|/*marker3*/stubonlypkg.missing|] import helper -//// from stubonlypkg import [|/*marker4*/missing|] - -helper.verifyDiagnostics({ - markerMissing: { - category: 'error', - message: 'Import "pyconlymod" could not be resolved', - }, - markerMidpath: { - category: 'error', - message: 'Import "midpathmod.sub" could not be resolved', - }, - marker1: { - category: 'warning', - message: 'Import "stubonlymod" could not be resolved from source', - }, - marker2: { - category: 'warning', - message: 'Import "stubonlymod" could not be resolved from source', - }, - marker3: { - category: 'warning', - message: 'Import "stubonlypkg.missing" could not be resolved from source', - }, - marker4: { - category: 'warning', - message: 'Import "stubonlypkg.missing" could not be resolved from source', - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.fourslash.ts deleted file mode 100644 index 803bc704..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.fourslash.ts +++ /dev/null @@ -1,69 +0,0 @@ -/// - -// @filename: test.py -//// -//// import [|/*marker1*/myLib.module|] -//// import myLib.module1 -//// -//// from [|/*marker2*/myLib.module|] import foo -//// from myLib import [|/*marker3*/module|] -//// -//// from [|/*marker4*/.conflict.module2|] import foo2 -//// from .conflict import [|/*marker5*/module2|] -//// -//// import [|/*marker6*/myLib.module|] as m1 -//// from myLib import [|/*marker7*/module|] as m2 -//// from .conflict import [|/*marker8*/module2|] as m3 - -// @filename: myLib/module.pyi -//// def foo(): ... - -// @filename: myLib/module1.pyi -//// - -// @filename: myLib/module1.py -//// - -// @filename: conflict/module2.pyi -//// def foo2(): ... - -// @filename: conflict/module2.py -// @library: true -//// - -{ - helper.verifyDiagnostics({ - marker1: { - category: 'warning', - message: 'Import "myLib.module" could not be resolved from source', - }, - marker2: { - category: 'warning', - message: 'Import "myLib.module" could not be resolved from source', - }, - marker3: { - category: 'warning', - message: 'Import "myLib.module" could not be resolved from source', - }, - marker4: { - category: 'warning', - message: 'Import ".conflict.module2" could not be resolved from source', - }, - marker5: { - category: 'warning', - message: 'Import ".conflict.module2" could not be resolved from source', - }, - marker6: { - category: 'warning', - message: 'Import "myLib.module" could not be resolved from source', - }, - marker7: { - category: 'warning', - message: 'Import "myLib.module" could not be resolved from source', - }, - marker8: { - category: 'warning', - message: 'Import ".conflict.module2" could not be resolved from source', - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.nativeSubmodule.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.nativeSubmodule.fourslash.ts deleted file mode 100644 index 7b1dc674..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/diagnostics.missingModuleSource.nativeSubmodule.fourslash.ts +++ /dev/null @@ -1,67 +0,0 @@ -/// - -// Importing a submodule of a native extension that ships type stubs should NOT -// emit a spurious `reportMissingModuleSource` warning. The package is an -// installed (library) native extension: a `.pyd`/`.so` backs the parent module -// and `.pyi` stubs describe the submodules. A compiled extension has no Python -// source, but the runtime module DOES exist (the native lib), so the warning is -// meaningless. -// -// Faithful layout note: the native lib, the package source, and the stubs are -// all co-located in the same (library) search root, mirroring an installed -// package. Marking each file `@library: true` keeps them together in the -// library folder (and out of the harness source-file checks). - -// @filename: nativelib/__init__.py -// @library: true -//// # Regular installed-package source for the top-level package. - -// @filename: nativelib/color.pyd -// @library: true -//// # Native library backing the `color` submodule (compiled extension). - -// @filename: nativelib/color/__init__.pyi -// @library: true -//// # Stub package for the native `color` module. - -// @filename: nativelib/color/style.pyi -// @library: true -//// def make_style() -> int: ... - -// @filename: stubonlylib/__init__.pyi -// @library: true -//// # Stub-only package: no source, no native lib (control case). - -// @filename: stubonlylib/missing.pyi -// @library: true -//// def helper() -> int: ... - -// @filename: test.py -//// # --- visitModuleName path (`import a.b.c` / `from a.b.c import name`) --- -//// # Submodule of a native extension: stubs + native parent lib -> NO warning. -//// import nativelib.color.style -//// from nativelib.color.style import make_style -//// -//// # --- visitImportFromAs submoduleFallback path (`from pkg import submodule`) --- -//// # Native-backed submodule imported as a name: the `style` alias resolves to a stub -//// # (`color/style.pyi`) while the native `color.pyd` sits mid-path, so the non-stub -//// # resolution reports isNativeLib. Exercises the second guard call site -> NO warning. -//// from nativelib.color import style -//// -//// # Stub-only submodule imported as a name -> warning MUST still fire (regression guard -//// # for the visitImportFromAs call site). -//// from stubonlylib import [|/*marker2*/missing|] -//// -//// # Stub-only dotted module (visitModuleName control) -> warning MUST still fire. -//// from [|/*marker1*/stubonlylib.missing|] import helper - -helper.verifyDiagnostics({ - marker1: { - category: 'warning', - message: 'Import "stubonlylib.missing" could not be resolved from source', - }, - marker2: { - category: 'warning', - message: 'Import "stubonlylib.missing" could not be resolved from source', - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.builtinClass.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.builtinClass.fourslash.ts deleted file mode 100644 index dd4f8616..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.builtinClass.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test.py -//// from operator import itemgetter -//// x = 4 -//// itemgetter().[|/*marker*/__call__|](x) - -// @filename: operator.py -// @library: true -//// class itemgetter: -//// def [|__call__|](self, obj): -//// pass -//// - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker: { - definitions: rangeMap - .get('__call__')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.classes.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.classes.fourslash.ts deleted file mode 100644 index 15aef34c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.classes.fourslash.ts +++ /dev/null @@ -1,106 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// class C: ... -//// -//// class C2: ... -//// -//// class C3: ... -//// -//// class C4: ... -//// -//// def C5(a, b): ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// class [|C|]: -//// pass -//// -//// [|C3|] = D.C3 -//// [|C4|] = D.N.C4 -//// -//// class [|C5|]: -//// def __init__(self, a, b): -//// pass - -// @filename: testLib1/M.py -// @library: true -//// class [|C2|]: -//// pass - -// @filename: testLib1/D.py -// @library: true -//// class [|C3|]: -//// pass -//// -//// class N: -//// class [|C4|]: -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker1*/C|]() -//// a = testLib1.[|/*marker2*/C2|]() -//// a = testLib1.[|/*marker3*/C3|]() -//// a = testLib1.[|/*marker4*/C4|]() -//// a = testLib1.[|/*marker5*/C5|](1, 2) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('C')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('C2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('C3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('C4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('C5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.dataclasses.converter.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.dataclasses.converter.fourslash.ts deleted file mode 100644 index fbce7c13..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.dataclasses.converter.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @filename: test.py -//// from typing import Any, Callable, dataclass_transform -//// -//// -//// def converter_simple(s: str) -> int: -//// ... -//// -//// -//// def model_field(*, converter: Callable[..., Any]) -> Any: -//// ... -//// -//// -//// @dataclass_transform(field_specifiers=(model_field,)) -//// class ModelBase: -//// ... -//// -//// -//// class A(ModelBase): -//// [|converted_attribute|]: int = model_field(converter=converter_simple) -//// -//// -//// a = A("1") -//// print(a.[|/*marker*/converted_attribute|]) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions({ - marker: { - definitions: rangeMap - .get('converted_attribute')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.ts deleted file mode 100644 index 8217158d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// def [|func1|](a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// def [|/*ignore*/func1|](a: str): ... - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -// @filename: mylib/__init__.py -// @library: true -//// from ._private import Foo as _Foo -//// foo = _Foo() - -// @filename: mylib/_private.py -// @library: true -//// class Foo: -//// def [|func|](self) -> int: -//// return 1 - -// @filename: typings/mylib/__init__.pyi -//// class Foo: -//// def [|/*ignore2*/func|](self) -> int: ... -//// -//// foo: Foo - -// @filename: test2.py -//// from mylib import foo -//// foo.[|/*marker2*/func|]() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - const testLib1Ranges = ranges.filter((r) => r.fileName.replace(/\\/g, '/').endsWith('testLib1/__init__.py')); - const myLibRanges = ranges.filter((r) => r.fileName.replace(/\\/g, '/').endsWith('mylib/_private.py')); - - helper.verifyFindDefinitions( - { - marker: { - definitions: testLib1Ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: myLibRanges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.ts deleted file mode 100644 index 52f81a9c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @filename: typings/testLib1/__init__.pyi -//// def [|func1|](a: str): ... - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions( - { - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.ts deleted file mode 100644 index 0557d838..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// def [|/*ignore*/func1|](a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// def [|func1|](a: str): ... - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions( - { - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferStubs' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.ts deleted file mode 100644 index 3e9a3479..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.ts +++ /dev/null @@ -1,25 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -//// def [|func1|](a): -//// pass - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions( - { - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferStubs' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.fields.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.fields.fourslash.ts deleted file mode 100644 index 64de4d03..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.fields.fourslash.ts +++ /dev/null @@ -1,136 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// from typing import ClassVar -//// -//// class C: -//// V = ... -//// -//// class C2: -//// V2 = ... -//// -//// class C3: -//// V3 = ... -//// -//// class C4: -//// V4: ClassVar[int] = ... -//// -//// class C5: -//// V5: ClassVar[int] = ... -//// -//// class C6: -//// V6 = ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// class C: -//// def __init__(self): -//// self.[|V|] = 1 -//// -//// C3 = D.C3 -//// C4 = D.N.C4 -//// -//// class B: -//// [|V5|] = 1 -//// -//// def __init__(self): -//// self.[|V6|] = 1 -//// -//// class C5(B): -//// pass -//// -//// class C6(B): -//// pass - -// @filename: testLib1/M.py -// @library: true -//// class C2: -//// def __init__(self): -//// self.[|V2|] = 1 - -// @filename: testLib1/D.py -// @library: true -//// class C3: -//// def [|__init__|](self): -//// self.[|V3|] = 1 -//// -//// class N: -//// class C4: -//// [|V4|] = 1 - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.C().[|/*marker1*/V|]() -//// a = testLib1.C2().[|/*marker2*/V2|]() -//// a = testLib1.C3().[|/*marker3*/V3|]() -//// a = testLib1.C4().[|/*marker4*/V4|]() -//// a = testLib1.C5().[|/*marker5*/V5|]() -//// a = testLib1.C6().[|/*marker6*/V6|]() - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('V')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('V2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('V3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('V4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('V5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker6: { - definitions: rangeMap - .get('V6')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.functions.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.functions.fourslash.ts deleted file mode 100644 index 8a1e902c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.functions.fourslash.ts +++ /dev/null @@ -1,92 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// def C(): ... -//// -//// def C2(): ... -//// -//// def C3(): ... -//// -//// def C4(): ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// def [|C|](): -//// pass -//// -//// [|C3|] = D.C3 -//// [|C4|] = D.Generate() - -// @filename: testLib1/M.py -// @library: true -//// def [|C2|](): -//// pass - -// @filename: testLib1/D.py -// @library: true -//// def [|C3|](): -//// pass -//// -//// def Generate(): -//// def [|C4|](): -//// pass -//// return C4; - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker1*/C|]() -//// a = testLib1.[|/*marker2*/C2|]() -//// a = testLib1.[|/*marker3*/C3|]() -//// a = testLib1.[|/*marker4*/C4|]() - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('C')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('C2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('C3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('C4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.methods.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.methods.fourslash.ts deleted file mode 100644 index 60a13a88..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.methods.fourslash.ts +++ /dev/null @@ -1,167 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// from typing import overload -//// -//// class C: -//// def method(self): ... -//// -//// class C2: -//// def method2(self): ... -//// -//// class C3: -//// def method3(self): ... -//// -//// class C4: -//// def method4(self): ... -//// -//// class C5: -//// def method5(self): ... -//// -//// class C6: -//// def method6(self): ... -//// -//// class C7: -//// @overload -//// def method7(self): ... -//// @overload -//// def method7(self, a): ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// class C: -//// def [|method|](self): -//// pass -//// -//// C3 = D.C3 -//// C4 = D.N.C4 -//// -//// class B: -//// def [|method5|](self): -//// pass -//// -//// def method6(self): -//// pass -//// -//// class C5(B): -//// pass -//// -//// class C6(B): -//// def [|method6|](self): -//// pass -//// -//// class C7: -//// def [|method7|](self, a): -//// pass - -// @filename: testLib1/M.py -// @library: true -//// class C2: -//// def [|method2|](self): -//// pass - -// @filename: testLib1/D.py -// @library: true -//// class C3: -//// def [|method3|](self): -//// pass -//// -//// class N: -//// class C4: -//// def [|method4|](self): -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// testLib1.C().[|/*marker1*/method|]() -//// testLib1.C2().[|/*marker2*/method2|]() -//// testLib1.C3().[|/*marker3*/method3|]() -//// testLib1.C4().[|/*marker4*/method4|]() -//// testLib1.C5().[|/*marker5*/method5|]() -//// testLib1.C6().[|/*marker6*/method6|]() -//// testLib1.C7().[|/*marker7*/method7|]() -//// testLib1.C7().[|/*marker7_1*/method7|](1) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('method')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('method2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('method3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('method4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('method5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker6: { - definitions: rangeMap - .get('method6')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker7: { - definitions: rangeMap - .get('method7')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker7_1: { - definitions: rangeMap - .get('method7')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.modules.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.modules.fourslash.ts deleted file mode 100644 index 7e366f22..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.modules.fourslash.ts +++ /dev/null @@ -1,50 +0,0 @@ -/// - -// @filename: testLib1/__init__.pyi -// @library: true -//// from . import M as M -//// from . import D as D - -// @filename: testLib1/D.pyi -// @library: true -//// # empty - -// @filename: testLib1/__init__.py -// @library: true -//// [|/*def1*/|]# empty - -// @filename: testLib1/M.py -// @library: true -//// [|/*def2*/|]# empty - -// @filename: testLib1/D.py -// @library: true -//// [|/*def3*/|]# empty - -// @filename: test.py -//// import [|/*marker1*/testLib1|] -//// import testLib1.[|/*marker2*/M|] -//// import testLib1.[|/*marker3*/D|] - -{ - helper.verifyFindDefinitions( - { - marker1: { - definitions: [ - { path: helper.getMarkerByName('def1').fileName, range: helper.getPositionRange('def1') }, - ], - }, - marker2: { - definitions: [ - { path: helper.getMarkerByName('def2').fileName, range: helper.getPositionRange('def2') }, - ], - }, - marker3: { - definitions: [ - { path: helper.getMarkerByName('def3').fileName, range: helper.getPositionRange('def3') }, - ], - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImport.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImport.fourslash.ts deleted file mode 100644 index c015f44e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImport.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "extraPaths": ["subproj"] -//// } - -// @filename: subproj/foo/bar1.py -//// [|/*def1*/x|] = 1 - -// @filename: foo/bar2.py -//// [|/*def2*/x|] = 1 - -// @filename: test.py -//// from foo import [|/*marker1*/bar1|] -//// from foo import [|/*marker2*/bar2|] - -{ - helper.verifyFindDefinitions( - { - marker1: { - definitions: [ - { - path: helper.getMarkerByName('def1').fileName, - range: { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } }, - }, - ], - }, - marker2: { - definitions: [ - { - path: helper.getMarkerByName('def2').fileName, - range: { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } }, - }, - ], - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.ts deleted file mode 100644 index f0dcebec..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true, -//// "executionEnvironments": [{ "root": "."}], -//// "venv": ".venv", -//// "venvPath": ".", -//// } - -// @filename: .venv/lib/site-packages/lib1.pth -//// lib1 - -// @filename: .venv/lib/site-packages/lib2.pth -//// lib2 - -// @filename: .venv/lib/site-packages/lib1/a/b/main.py -//// - -// @filename: .venv/lib/site-packages/lib2/a/b/__init__.py -//// [|/*def1*/x|] = 1 - -// @filename: test.py -//// from a.b import [|/*marker1*/x|] - -{ - helper.verifyFindDefinitions( - { - marker1: { - definitions: [ - { - path: helper.getMarkerByName('def1').fileName, - range: { start: { line: 0, character: 0 }, end: { line: 0, character: 1 } }, - }, - ], - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.overloads.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.overloads.fourslash.ts deleted file mode 100644 index 42e1ac1b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.overloads.fourslash.ts +++ /dev/null @@ -1,223 +0,0 @@ -/// - -// @filename: testLib1/__init__.pyi -// @library: true -//// from typing import overload -//// -//// class C: -//// @overload -//// def method(self): ... -//// @overload -//// def method(self, a): ... -//// -//// class C2: -//// @overload -//// def method2(self): ... -//// @overload -//// def method2(self, a): ... -//// -//// class C3(C2): -//// @overload -//// def method2(self): ... -//// @overload -//// def method2(self, a): ... -//// -//// class C4: -//// @overload -//// def method4(self): ... -//// @overload -//// def method4(self, a): ... -//// -//// class C5: -//// @overload -//// def method5(self): ... -//// @overload -//// def method5(self, a): ... -//// -//// class C6: -//// @overload -//// def method6(self): ... -//// @overload -//// def method6(self, a): ... -//// -//// @overload -//// def method7(): ... -//// @overload -//// def method7(a): ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2, C3 as MC3, method7 as m7 -//// from . import D -//// -//// class C: -//// @overload -//// def [|method|](self): -//// pass -//// -//// @overload -//// def [|method|](self, a): -//// pass -//// -//// C3 = MC3 -//// C4 = D.N.C4 -//// -//// class B: -//// @overload -//// def [|method5|](self): -//// pass -//// -//// def [|method5|](self, a): -//// pass -//// -//// @overload -//// def method6(self): -//// pass -//// -//// @overload -//// def method6(self, a): -//// pass -//// -//// class C5(B): -//// pass -//// -//// class C6(B): -//// @overload -//// def [|method6|](self): -//// pass -//// -//// @overload -//// def [|method6|](self, a): -//// pass -//// -//// [|method7|] = m7 - -// @filename: testLib1/M.pyi -// @library: true -//// from . import D -//// C2 = D.C2 -//// C3 = D.C3 -//// method7 = D.method7 - -// @filename: testLib1/M.py -// @library: true -//// from . import D -//// C2 = D.C2 -//// C3 = D.C3 -//// method7 = D.method7 - -// @filename: testLib1/D.pyi -// @library: true -//// class C2: -//// @overload -//// def method2(self): ... -//// @overload -//// def method2(self, a): ... -//// -//// class C3(C2): ... -//// -//// class N: -//// class C4: -//// @overload -//// def method4(self): ... -//// @overload -//// def method4(self, a): ... -//// -//// @overload -//// def method7(): ... -//// @overload -//// def method7(a): ... - -// @filename: testLib1/D.py -// @library: true -//// class C2: -//// def [|method2|](self, a): -//// pass -//// -//// class C3(C2): -//// pass -//// -//// class N: -//// class C4: -//// def [|method4|](self, a): -//// pass -//// -//// def [|method7|](a): -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// testLib1.C().[|/*marker1*/method|]() -//// testLib1.C2().[|/*marker2*/method2|]() -//// testLib1.C3().[|/*marker3*/method2|]() -//// testLib1.C4().[|/*marker4*/method4|](1) -//// testLib1.C5().[|/*marker5*/method5|]() -//// testLib1.C6().[|/*marker6*/method6|](1) -//// testLib1.[|/*marker7*/method7|](1) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('method')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('method2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('method2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('method4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('method5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker6: { - definitions: rangeMap - .get('method6')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker7: { - definitions: rangeMap - .get('method7')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.parameters.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.parameters.fourslash.ts deleted file mode 100644 index 48264c29..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.parameters.fourslash.ts +++ /dev/null @@ -1,167 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// from typing import overload -//// -//// class C: -//// def method(self, a): ... -//// -//// class C2: -//// def method2(self, a2): ... -//// -//// class C3: -//// def method3(self, a3): ... -//// -//// class C4: -//// def method4(self, a4): ... -//// -//// class C5: -//// def method5(self, a5): ... -//// -//// class C6: -//// def method6(self, a6): ... -//// -//// class C7: -//// @overload -//// def method7(self, a7): ... -//// @overload -//// def method7(self, a7, b7): ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// class C: -//// def method(self, [|a|]): -//// pass -//// -//// C3 = D.C3 -//// C4 = D.N.C4 -//// -//// class B: -//// def method5(self, [|a5|]): -//// pass -//// -//// def method6(self, a6): -//// pass -//// -//// class C5(B): -//// pass -//// -//// class C6(B): -//// def method6(self, [|a6|]): -//// pass -//// -//// class C7: -//// def method7(self, [|a7|], [|b7|]): -//// pass - -// @filename: testLib1/M.py -// @library: true -//// class C2: -//// def method2(self, [|a2|]): -//// pass - -// @filename: testLib1/D.py -// @library: true -//// class C3: -//// def method3(self, [|a3|]): -//// pass -//// -//// class N: -//// class C4: -//// def method4(self, [|a4|]): -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// testLib1.C().method([|/*marker1*/a|] = 1) -//// testLib1.C2().method2([|/*marker2*/a2|] = 1) -//// testLib1.C3().method3([|/*marker3*/a3|] = 1) -//// testLib1.C4().method4([|/*marker4*/a4|] = 1) -//// testLib1.C5().method5([|/*marker5*/a5|] = 1) -//// testLib1.C6().method6([|/*marker6*/a6|] = 1) -//// testLib1.C7().method7([|/*marker7*/a7|] = 1) -//// testLib1.C7().method7(a7 = 1, [|/*marker7_1*/b7|] = 1) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('a')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('a2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('a3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('a4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('a5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker6: { - definitions: rangeMap - .get('a6')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker7: { - definitions: rangeMap - .get('a7')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker7_1: { - definitions: rangeMap - .get('b7')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.ts deleted file mode 100644 index b4b5da70..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// def [|func1|](a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// def [|func1|](a: str): ... - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.ts deleted file mode 100644 index 36bd5c95..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.ts +++ /dev/null @@ -1,32 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Outer: -//// class [|Middle|]: -//// class Inner: -//// def M(self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Outer: -//// class [|Middle|]: -//// class Inner: -//// def M(self, a: str): ... - -// @filename: test.py -//// import testLib1 -//// -//// testLib1.Outer.[|/*marker*/Middle|].Inner() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.ts deleted file mode 100644 index a71e7fb2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Outer: -//// class Middle: -//// class Inner: -//// def [|M|](self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Outer: -//// class Middle: -//// class Inner: -//// def [|M|](self, a: str): ... - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.Outer.Middle.Inner() -//// a.[|/*marker*/M|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.ts deleted file mode 100644 index 10ec408a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class [|Test1|]: -//// def M(self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class [|Test1|]: -//// def M(self, a: str): ... - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker*/Test1|]() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.ts deleted file mode 100644 index 91c4259a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// def [|M|](self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// def [|M|](self, a: str): ... - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.Test1() -//// a.[|/*marker*/M|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.ts deleted file mode 100644 index 36a63cc5..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// @property -//// def [|P|](self): -//// return '' - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// @property -//// def [|P|](self) -> str: ... - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.Test1() -//// a.[|/*marker*/P|] - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.ts deleted file mode 100644 index cc064206..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// @property -//// def [|P|](self): -//// return '' -//// @P.setter -//// def [|P|](self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// @property -//// def [|P|](self) -> str: ... -//// @P.setter -//// def [|P|](self, a: str): ... - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.Test1() -//// a.[|/*marker*/P|] - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.ts deleted file mode 100644 index bff1f92e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class [|Test1|]: -//// def M(self, a: str): -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker*/Test1|]() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.ts deleted file mode 100644 index 640f53c2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// def [|func1|](a): -//// pass - -// @filename: test.py -//// from testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.ts deleted file mode 100644 index 094e04ce..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// def [|func1|](a): -//// pass - -// @filename: test.py -//// from testLib1 import func1 as test_func1 -//// -//// [|/*marker*/test_func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.ts deleted file mode 100644 index d57410a3..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -//// def [|func1|](a): -//// pass - -// @filename: test.py -//// from .testLib1 import func1 -//// -//// [|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.ts deleted file mode 100644 index 727ce91d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -//// def [|func1|](a): -//// pass - -// @filename: test.py -//// from . import testLib1 -//// -//// testLib1.[|/*marker*/func1|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindDefinitions({ - marker: { - definitions: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubOnly.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubOnly.fourslash.ts deleted file mode 100644 index 66c88437..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubOnly.fourslash.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// - -// @filename: typings/testLib1/__init__.pyi -//// from typing import overload -//// -//// class [|Test1|]: -//// def M(self, a: str): -//// pass -//// @overload -//// def [|OL|](self, [|a|]): -//// pass -//// @overload -//// def [|OL|](self, [|a|], [|b|]): -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker*/Test1|]() -//// testLib1.Test1().[|/*marker2*/OL|]("hello") -//// testLib1.Test1().OL([|/*marker3*/a|] = "hello") -//// testLib1.Test1().OL(a = "hello", [|/*marker4*/b|] = 1) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions({ - marker: { - definitions: rangeMap - .get('Test1')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('OL')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('a')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('b')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubPackages.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubPackages.fourslash.ts deleted file mode 100644 index 3a34b42c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.stubPackages.fourslash.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1-stubs/py.typed -// @library: true -//// partial -//// - -// @filename: testLib1-stubs/__init__.pyi -// @library: true -//// from .core import C as C -//// from .base import C2 as C2 - -// @filename: testLib1/__init__.py -// @library: true -//// from .core import C -//// from .base import C2 as C2 - -// @filename: testLib1-stubs/core/__init__.pyi -// @library: true -//// class [|C|]: ... - -// @filename: testLib1/core/__init__.py -// @library: true -//// class C: -//// pass - -// @filename: testLib1/base/__init__.py -// @library: true -//// from ..main import C2 as C2 - -// @filename: testLib1/main.py -// @library: true -//// class [|C2|]: -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker1*/C|]() -//// a = testLib1.[|/*marker2*/C2|]() - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('C')! - .filter((r) => !r.marker) - .map((r) => { - return { path: helper.getMappedFilePath(r.fileName), range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('C2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferStubs' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.typedDict.keys.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.typedDict.keys.fourslash.ts deleted file mode 100644 index f786d8cd..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.typedDict.keys.fourslash.ts +++ /dev/null @@ -1,108 +0,0 @@ -/// - -// @filename: a.py -//// from typing import TypedDict -//// -//// class Post(TypedDict, total=False): -//// [|title|] : str -//// author: 'Author' -//// -//// class AuthorOptionalData(TypedDict, total=False): -//// [|age|]: int -//// -//// class Author(AuthorOptionalData): -//// [|name|] : str -//// -//// Profile = TypedDict( -//// 'Profile', -//// { -//// 'bio': str, -//// [|'views'|]: int, -//// }, -//// total=False, -//// ) - -// @filename: test.py -//// from a import Post, Author, Profile -//// -//// author: Author = {[|/*marker1*/'name'|]: 'Robert'} -//// post: Post = {'author': {[|/*marker2*/'name'|]}} -//// profile: Profile = {[|/*marker3*/'views'|]: 100} -//// author: Author = {'name': 'Robert', [|/*marker4*/'age'|]: 67} -//// author2: Author = Author([|/*marker8*/name|]='Robert', age=67) -//// -//// def foo(item: Post | Author) -> None: -//// ... -//// -//// foo(item={[|/*marker5*/'title'|]}) -//// foo(item={'title': [|/*marker6*/'title'|]}) -//// foo(item={[|/*marker7*/'name'|]}) - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('name')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('name')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get("'views'")! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('age')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('title')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker6: { - definitions: [], - }, - marker7: { - definitions: rangeMap - .get('name')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker8: { - definitions: rangeMap - .get('name')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.variables.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.variables.fourslash.ts deleted file mode 100644 index 07d30f32..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.variables.fourslash.ts +++ /dev/null @@ -1,93 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// C = ... -//// -//// C2 = ... -//// -//// C3 = ... -//// -//// C4 = ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// [|C|] = 1 -//// -//// [|C3|] = D.C3 -//// [|C4|] = D.Generate() - -// @filename: testLib1/M.py -// @library: true -//// [|C2|] = 1 - -// @filename: testLib1/D.pyi -// @library: true -//// C3 = ... -//// -//// def Generate(): ... - -// @filename: testLib1/D.py -// @library: true -//// C3 = 1 -//// -//// def Generate(): -//// return 1; - -// @filename: test.py -//// import testLib1 -//// -//// a = testLib1.[|/*marker1*/C|] -//// a = testLib1.[|/*marker2*/C2|] -//// a = testLib1.[|/*marker3*/C3|] -//// a = testLib1.[|/*marker4*/C4|] - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('C')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('C2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('C3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('C4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.wildcardimports.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findDefinitions.wildcardimports.fourslash.ts deleted file mode 100644 index 867aa751..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findDefinitions.wildcardimports.fourslash.ts +++ /dev/null @@ -1,122 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: lib1/definition.py -// @library: true -//// def [|func|](): -//// '''func docs''' -//// pass -//// -//// class MyType: -//// def [|func2|](): -//// '''func2 docs''' -//// pass - -// @filename: lib1/alias.py -// @library: true -//// def [|func3|](): -//// '''func3 docs''' -//// pass - -// @filename: lib1/withall.py -// @library: true -//// def [|func4|](): -//// '''func4 docs''' -//// pass -//// -//// def [|func5|](): -//// '''func5 docs''' -//// pass -//// -//// __all__ = ['func5'] - -// @filename: lib1/redirect.py -// @library: true -//// from . import withall -//// from .withall import * -//// -//// __all__ += withall.__all__ - -// @filename: lib1/wildcard.py -// @library: true -//// from .definition import * -//// from .redirect import * -//// from .alias import func3 - -// @filename: lib1/__init__.py -// @library: true -//// from .wildcard import * - -// @filename: lib1/__init__.pyi -// @library: true -//// class ufunc: -//// def __call__(self) -> None : ... -//// -//// func: ufunc -//// class MyType: -//// def func2() -> None : ... -//// func3: ufunc -//// func4: ufunc -//// func5: ufunc - -// @filename: test.py -//// import lib1 -//// lib1.[|/*marker1*/func|]() -//// lib1.MyType().[|/*marker2*/func2|]() -//// lib1.[|/*marker3*/func3|]() -//// lib1.[|/*marker4*/func4|]() -//// lib1.[|/*marker5*/func5|]() - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindDefinitions( - { - marker1: { - definitions: rangeMap - .get('func')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker2: { - definitions: rangeMap - .get('func2')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker3: { - definitions: rangeMap - .get('func3')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker4: { - definitions: rangeMap - .get('func4')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker5: { - definitions: rangeMap - .get('func5')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }, - 'preferSource' - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.ts deleted file mode 100644 index ce9ec6f9..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: test.py -//// [|/*marker1*/a|] = 1 - -// @filename: typeshed-fallback/stdlib/builtins.pyi -//// class [|int|]: -//// @overload -//// def __new__(cls: Type[_T], x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ... -//// @overload -//// def __new__(cls: Type[_T], x: str | bytes | bytearray, base: SupportsIndex) -> _T: ... - -{ - const rangeMap = helper.getRangesByText(); - - helper.verifyFindTypeDefinitions({ - marker1: { - definitions: rangeMap - .get('int')! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.classes.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.classes.fourslash.ts deleted file mode 100644 index 885149d4..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.classes.fourslash.ts +++ /dev/null @@ -1,77 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.pyi -// @library: true -//// class [|C|]: ... -//// -//// class [|C2|]: ... -//// -//// class [|C3|]: ... -//// -//// class [|C4|]: ... -//// -//// class [|C5|]: ... - -// @filename: testLib1/__init__.py -// @library: true -//// from .M import C2 -//// from . import D -//// -//// class [|C|]: -//// pass -//// -//// [|C3|] = D.C3 -//// [|C4|] = D.N.C4 -//// -//// class [|C5|]: -//// def __init__(self, a, b): -//// pass - -// @filename: testLib1/M.py -// @library: true -//// class [|C2|]: -//// pass - -// @filename: testLib1/D.py -// @library: true -//// class [|C3|]: -//// pass -//// -//// class N: -//// class [|C4|]: -//// pass - -// @filename: test.py -//// import testLib1 -//// -//// [|/*marker1*/a|] = testLib1.C() -//// [|/*marker2*/a|] = testLib1.C2() -//// [|/*marker3*/a|] = testLib1.C3() -//// [|/*marker4*/a|] = testLib1.C4() -//// [|/*marker5*/a|] = testLib1.C5(1, 2) - -{ - const rangeMap = helper.getRangesByText(); - - var _getRanges = function (rangeName: string): _.DocumentRange[] { - return rangeMap - .get(rangeName)! - .filter((r) => !r.marker) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - }; - - helper.verifyFindTypeDefinitions({ - marker1: { definitions: _getRanges('C') }, - marker2: { definitions: _getRanges('C2') }, - marker3: { definitions: _getRanges('C3') }, - marker4: { definitions: _getRanges('C4') }, - marker5: { definitions: _getRanges('C5') }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.unions.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.unions.fourslash.ts deleted file mode 100644 index f6965e57..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findTypeDefinitions.unions.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: test.py -//// from typing import Union -//// -//// class [|C1|]: -//// pass -//// -//// class N: -//// class [|C2|]: -//// pass -//// -//// def foo([|/*marker1*/a|]: Union[C1, N.C2]): -//// pass - -{ - helper.verifyFindTypeDefinitions({ - marker1: { - definitions: helper - .getFilteredRanges<{ target?: string }>((m, d, t) => t === 'C1' || t === 'C2') - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.classPropertyReadWrite.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.classPropertyReadWrite.ts deleted file mode 100644 index 958b8d5f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.classPropertyReadWrite.ts +++ /dev/null @@ -1,39 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -//// class Test1: -//// @property -//// def [|P|](self): -//// return '' -//// @[|P|].setter -//// def [|P|](self, a): -//// pass - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// a = Test1() -//// a.[|/*marker*/P|] = '' -//// val = a.[|P|] - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() -//// func(b) -//// -//// def func(t: Test1): -//// t.[|P|] = '' -//// print(t.[|P|]) - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.fourslash.ts deleted file mode 100644 index 0cf0902a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.fourslash.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class [|Test1|]: -//// def M(self, a: Test1): -//// pass - -// @filename: test.py -//// from testLib1 import [|Test1|] -//// -//// a = [|/*marker*/Test1|]() - -// @filename: test2.py -//// from testLib1 import [|Test1|] -//// -//// b = [|Test1|]() - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.importalias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.importalias.fourslash.ts deleted file mode 100644 index f530658d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.importalias.fourslash.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// def M(self, a: Test1): -//// pass - -// @filename: test.py -//// from testLib1 import Test1 as [|t1|] -//// -//// a = [|[|/*marker*/t1|]|]() - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.ts deleted file mode 100644 index 2c6756b9..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class [|/*marker*/Test1|]: -//// def M(self, a: '[|Test1|]'): -//// pass - -// @filename: testLib2/__init__.py -// @library: true -//// # We need an indexer to discover references in closed files -//// # that are not referenced in open files (or workspace depends on diagnostic mode) -//// from testLib1 import Test1 -//// -//// a = Test1() - -// @filename: testLib3/__init__.py -// @library: true -//// from testLib1 import [|Test1|] -//// -//// class Test3: -//// def M(self, a: [|Test1|]): -//// pass - -// @filename: test.py -//// from testLib1 import [|Test1|] -//// -//// a = [|Test1|]() - -// @filename: test2.py -//// from testLib1 import [|Test1|] -//// from testLib3 import Test3 -//// -//// a = Test3() -//// b = [|Test1|]() - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.module.nested.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.module.nested.fourslash.ts deleted file mode 100644 index 75fb6be7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.module.nested.fourslash.ts +++ /dev/null @@ -1,67 +0,0 @@ -/// - -// @filename: nested/__init__.py -//// from .[|/*module1*/module1|] import module1Func as module1Func - -// @filename: nested/module1.py -//// def module1Func(): -//// pass - -// @filename: test1.py -//// import [|/*nest1*/nested|].[|/*module2*/module1|] -//// import [|/*nest2*/nested|].[|/*module3*/module1|] as m -//// -//// [|/*nest3*/nested|].[|/*module4*/module1|].module1Func() - -// @filename: test2.py -//// from [|/*nest4*/nested|].[|/*module5*/module1|] import module1Func -//// from .[|/*nest5*/nested|].[|/*module6*/module1|] import module1Func as f - -// @filename: test3.py -//// from .[|/*nest6*/nested|] import [|/*module7*/module1|] -//// from .[|/*nest7*/nested|] import [|/*module8*/module1|] as m - -// @filename: code/test4.py -//// from ..[|/*nest8*/nested|] import [|/*module9*/module1|] -//// from ..[|/*nest9*/nested|] import [|/*module10*/module1|] as m -//// from ..[|/*nest10*/nested|].[|/*module11*/module1|] import module1Func - -{ - const nestedReferences = helper - .getRangesByText() - .get('nested')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - const moduleReferences = helper - .getRangesByText() - .get('module1')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - helper.verifyFindAllReferences({ - nest1: { references: nestedReferences }, - nest2: { references: nestedReferences }, - nest3: { references: nestedReferences }, - nest4: { references: nestedReferences }, - nest5: { references: nestedReferences }, - nest6: { references: nestedReferences }, - nest7: { references: nestedReferences }, - nest8: { references: nestedReferences }, - nest9: { references: nestedReferences }, - nest10: { references: nestedReferences }, - module1: { references: moduleReferences }, - module2: { references: moduleReferences }, - module3: { references: moduleReferences }, - module4: { references: moduleReferences }, - module5: { references: moduleReferences }, - module6: { references: moduleReferences }, - module7: { references: moduleReferences }, - module8: { references: moduleReferences }, - module9: { references: moduleReferences }, - module10: { references: moduleReferences }, - module11: { references: moduleReferences }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.duplicated.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.duplicated.fourslash.ts deleted file mode 100644 index 6a6a1aeb..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.duplicated.fourslash.ts +++ /dev/null @@ -1,59 +0,0 @@ -/// - -// @filename: module1.py -//// def module1Func(): -//// pass - -// @filename: nest/__init__.py -//// # empty - -// @filename: nest/module1.py -//// def nestModule1Func(): -//// pass - -// @filename: test1.py -//// from [|/*marker1*/nest|] import [|/*marker2*/module1|] -//// -//// from [|/*marker3*/nest|].[|/*marker4*/module1|] import module1Func -//// -//// import [|/*marker5*/nest|].[|/*marker6*/module1|] -//// import [|/*marker7*/module1|] -//// -//// [|/*marker8*/nest|].[|/*marker9*/module1|] - -{ - const nestReferences = helper - .getRangesByText() - .get('nest')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - const marker7 = helper.getMarkerByName('marker7'); - const module1References = helper - .getRangesByText() - .get('module1')! - .filter((r) => r.marker !== marker7) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - helper.verifyFindAllReferences({ - marker1: { references: nestReferences }, - marker2: { references: module1References }, - marker3: { references: nestReferences }, - marker4: { references: module1References }, - marker5: { references: nestReferences }, - marker6: { references: module1References }, - marker7: { - references: helper - .getRanges() - .filter((r) => r.marker === marker7) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - marker8: { references: nestReferences }, - marker9: { references: module1References }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.fourslash.ts deleted file mode 100644 index a2202144..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.fourslash.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// - -// @filename: module1.py -//// def module1Func(): -//// pass - -// @filename: test1.py -//// import [|/*marker1*/module1|] -//// import [|/*marker2*/module1|] as m -//// -//// [|/*marker3*/module1|].module1Func() - -// @filename: test2.py -//// from [|/*marker4*/module1|] import module1Func -//// from .[|/*marker5*/module1|] import module1Func as f - -// @filename: test3.py -//// from . import [|/*marker6*/module1|] -//// from . import [|/*marker7*/module1|] as m - -// @filename: nested/test4.py -//// from .. import [|/*marker8*/module1|] -//// from .. import [|/*marker9*/module1|] as m -//// from ..[|/*marker10*/module1|] import module1Func - -{ - const references = helper - .getRangesByText() - .get('module1')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - helper.verifyFindAllReferences({ - marker1: { references }, - marker2: { references }, - marker3: { references }, - marker4: { references }, - marker5: { references }, - marker6: { references }, - marker7: { references }, - marker8: { references }, - marker9: { references }, - marker10: { references }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.shadow.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.shadow.fourslash.ts deleted file mode 100644 index 6da52c54..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.modules.shadow.fourslash.ts +++ /dev/null @@ -1,95 +0,0 @@ -/// - -// @filename: module1.py -//// def module1Func(): -//// pass - -// @filename: nest1/__init__.py -//// # empty - -// @filename: nest1/module1.py -//// def nest1Module1Func(): -//// pass - -// @filename: nest1/nest2/__init__.py -//// # empty - -// @filename: nest1/nest2/module1.py -//// def nest2Module1Func(): -//// pass - -// @filename: test1.py -//// from [|/*nest1_1*/nest1|] import [|{| "name":"nest1_module1", "target":"nest1" |}module1|] -//// from [|/*nest1_2*/nest1|].[|/*nest2_1*/nest2|] import [|{| "name":"nest2_module1", "target":"nest2" |}module1|] -//// -//// import [|/*nest1_3*/nest1|] -//// import [|/*nest1_4*/nest1|].[|/*nest2_2*/nest2|] -//// import [|/*nest1_5*/nest1|].[|/*nest2_3*/nest2|].[|{| "name":"nest2_module2", "target":"nest2" |}module1|] -//// -//// from [|/*nest1_6*/nest1|] import [|/*nest2_4*/nest2|] -//// -//// [|{| "name":"module4" |}module1|] -//// [|/*nest1_7*/nest1|] -//// [|/*nest1_8*/nest1|].[|/*nest2_5*/nest2|] -//// [|/*nest1_9*/nest1|].[|{| "name":"module5", "target":"none" |}module1|] - -{ - const nest1References = helper - .getRangesByText() - .get('nest1')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - const nest2References = helper - .getRangesByText() - .get('nest2')! - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - const nest2ModuleReferences = helper - .getFilteredRanges<{ target?: string }>( - (m, d, t) => t === 'module1' && !!d && (!d.target || d.target === 'nest2') - ) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }); - - helper.verifyFindAllReferences({ - nest1_1: { references: nest1References }, - nest1_2: { references: nest1References }, - nest1_3: { references: nest1References }, - nest1_4: { references: nest1References }, - nest1_5: { references: nest1References }, - nest1_6: { references: nest1References }, - nest1_8: { references: nest1References }, - nest1_9: { references: nest1References }, - nest2_1: { references: nest2References }, - nest2_2: { references: nest2References }, - nest2_3: { references: nest2References }, - nest2_4: { references: nest2References }, - nest2_5: { references: nest2References }, - nest2_module1: { references: nest2ModuleReferences }, - nest2_module2: { references: nest2ModuleReferences }, - nest1_module1: { - references: helper - .getFilteredRanges<{ target?: string }>( - (m, d, t) => t === 'module1' && !!d && (!d.target || d.target === 'nest1') - ) - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - module4: { - references: helper - .getFilteredRanges<{ target?: string }>((m, d, t) => t === 'module1' && !!d && d.target !== 'none') - .map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - module5: { - references: [], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.openFiles.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.openFiles.fourslash.ts deleted file mode 100644 index f7dece73..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.openFiles.fourslash.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class [|/*lib*/Test1|]: -//// def M(self, a: '[|Test1|]'): -//// pass - -// @filename: test.py -//// from testLib1 import [|Test1|] -//// -//// a = [|/*marker*/Test1|]() - -// @filename: test2.py -//// from testLib1 import [|Test1|] -//// -//// b = [|Test1|]() - -{ - const ranges = helper.getRanges(); - - const libMarker = helper.getMarkerByName('lib'); - helper.openFile(libMarker.fileName); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.parameter.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.parameter.fourslash.ts deleted file mode 100644 index 27257beb..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.parameter.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @filename: test.py -//// def func([|/*marker*/a|]): -//// print([|a|]) -//// -//// a = 40 -//// func(a) - -// @filename: test2.py -//// a = 50 -//// print(a) - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.ts deleted file mode 100644 index d4ad5469..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class [|Test1|]: -//// def M(self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class [|Test1|]: -//// def M(self, a: str): ... - -// @filename: test.py -//// from testLib1 import [|Test1|] -//// -//// a = [|/*marker*/Test1|]() - -// @filename: test2.py -//// from testLib1 import [|Test1|] -//// -//// b = [|Test1|]() - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.ts deleted file mode 100644 index f1d37c08..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// def [|M|](self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// def [|M|](self, a: str): ... - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// Test1().[|/*marker*/M|]('') - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() -//// func(b) -//// -//// def func(t: Test1): -//// t.[|M|]('') - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.ts deleted file mode 100644 index 2c329775..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// @property -//// def [|P|](self): -//// return '' - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// @property -//// def [|P|](self) -> str: ... - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// a = Test1() -//// val = a.[|/*marker*/P|] - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() -//// func(b) -//// -//// def func(t: Test1): -//// print(t.[|P|]) - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.ts deleted file mode 100644 index 771744c5..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// @property -//// def [|P|](self): -//// return '' -//// # bug: these next 2 missing from results - disabling test until this is fixed, it actually works in the product -//// @[|P|].setter -//// def [|P|](self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// @property -//// def [|P|](self) -> str: ... -//// @[|P|].setter -//// def [|P|](self, a: str): ... - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// a = Test1() -//// a.[|/*marker*/P|] = '' -//// val = a.[|P|] - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() -//// func(b) -//// -//// def func(t: Test1): -//// t.[|P|] = '' -//// print(t.[|P|]) - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.ts deleted file mode 100644 index 4752293c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -// @filename: testLib1/__init__.py -// @library: true -//// def [|func1|](a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// def [|func1|](a: str): ... - -// @filename: test.py -//// from testLib1 import [|func1|] -//// -//// [|/*marker*/func1|]('') - -// @filename: test2.py -//// import testLib1 -//// -//// def func1(t: str): -//// pass -//// -//// func1('') -//// testLib1.[|func1|]('') - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/findallreferences.variable.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/findallreferences.variable.fourslash.ts deleted file mode 100644 index d3c62f78..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/findallreferences.variable.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @filename: test.py -//// def func(a): -//// print(a) -//// -//// [|/*marker*/a|] = 40 -//// func([|a|]) - -// @filename: test2.py -//// a = 50 -//// print(a) - -{ - const ranges = helper.getRanges(); - - helper.verifyFindAllReferences({ - marker: { - references: ranges.map((r) => { - return { path: r.fileName, range: helper.convertPositionRange(r) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/highlightreferences.attributes.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/highlightreferences.attributes.fourslash.ts deleted file mode 100644 index 62828217..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/highlightreferences.attributes.fourslash.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// @filename: test.py -//// class DummyClass: -//// def __init__(self): -//// self.[|{| "kind":"write" |}var|] = 1 -//// self.[|{| "kind":"write" |}var|] += 1 -//// -//// def method_1(self): -//// self.[|{| "kind":"write" |}var|] += 2 -//// self.[|{| "kind":"write" |}var|] = None -//// -//// def method_2(self): -//// self.[|{| "kind":"write" |}var|] += 3 -//// self.[|{| "kind":"write" |}var|] = None -//// self.[|{| "name":"marker", "kind":"write" |}var|] = 1 -//// -//// x = DummyClass() -//// print(x.[|{| "kind":"read" |}var|]) - -{ - const ranges = helper.getRanges(); - - helper.verifyHighlightReferences({ - marker: { - references: ranges.map((r) => { - return { range: helper.convertPositionRange(r), kind: helper.getDocumentHighlightKind(r.marker) }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.async.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.async.fourslash.ts deleted file mode 100644 index 9aa5b904..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.async.fourslash.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -// @filename: test.py -//// async def [|/*marker1*/test|](): -//// pass -//// -//// y = [|/*marker2*/test|] -helper.verifyHover('markdown', { - marker1: '```python\n(function) async def test() -> None\n```', - marker2: '```python\n(function) def test() -> CoroutineType[Any, Any, None]\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.ts deleted file mode 100644 index dc1b5808..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @filename: typeshed-fallback/stdlib/builtins.pyi -//// class baseClass: -//// def method(self) -> None: ... -//// -//// class derivedClass(baseClass): ... - -// @filename: typeshed-fallback/stdlib/builtins.py -//// class baseClass: -//// def method(self) -> None: -//// """baseClass doc string""" -//// pass -//// -//// class derivedClass(baseClass): -//// pass - -// @filename: test.py -//// x = derivedClass() -//// x.[|/*marker*/method|]() - -helper.verifyHover('markdown', { - marker: '```python\n(method) def method() -> None\n```\n---\nbaseClass doc string', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.ts deleted file mode 100644 index 74fd309d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @filename: typeshed-fallback/stdlib/builtins.pyi -//// class baseClass: -//// def method(self) -> None: ... - -// @filename: typeshed-fallback/stdlib/builtins.py -//// class baseClass: -//// def method(self) -> None: -//// """baseClass doc string""" -//// pass - -// @filename: test.py -//// class derivedClass(baseClass): -//// pass -//// -//// x = derivedClass() -//// x.[|/*marker*/method|]() - -helper.verifyHover('markdown', { - marker: '```python\n(method) def method() -> None\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.fourslash.ts deleted file mode 100644 index 5a11188e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.builtinDocstrings.fourslash.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// - -// @filename: docstrings.py -//// [|/*object*/object|] -//// [|/*objectInit*/object|]() -//// object().[|/*objectDir*/__dir__|] -//// -//// class A: ... -//// -//// [|/*a*/A|] -//// [|/*aInit*/A|]() -//// A().[|/*aDir*/__dir__|] -//// -//// class B: -//// """This is the class doc for B.""" -//// def __init__(self): -//// """This is the __init__ doc for B.""" -//// -//// [|/*b*/B|] -//// [|/*bInit*/B|]() -//// -//// class C: -//// """This is the class doc for C.""" -//// def __init__(self): -//// pass -//// -//// [|/*c*/C|] -//// [|/*cInit*/C|]() -//// -//// class D: -//// def __init__(self): -//// """This is the __init__ doc for D.""" -//// pass -//// -//// [|/*d*/D|] -//// [|/*dInit*/D|]() - -// @filename: typeshed-fallback/stdlib/builtins.py -//// class object(): -//// """This is the class doc for object.""" -//// def __init__(self): -//// """This is the __init__ doc for object.""" -//// pass -//// -//// def __dir__(self): -//// """This is the __dir__ doc for object.""" -//// pass - -{ - helper.verifyHover('plaintext', { - object: '(class) object\n\nThis is the class doc for object.', - objectInit: 'class object()\n\nThis is the __init__ doc for object.', - objectDir: '(method) def __dir__() -> Iterable[str]\n\nThis is the __dir__ doc for object.', - a: '(class) A', - aInit: 'class A()', - aDir: '(method) def __dir__() -> Iterable[str]', - b: '(class) B\n\nThis is the class doc for B.', - bInit: 'class B()\n\nThis is the __init__ doc for B.', - c: '(class) C\n\nThis is the class doc for C.', - cInit: 'class C()\n\nThis is the class doc for C.', - d: '(class) D', - dInit: 'class D()\n\nThis is the __init__ doc for D.', - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.class.docString.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.class.docString.fourslash.ts deleted file mode 100644 index 30df4d16..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.class.docString.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import lib -//// -//// lib.[|/*marker1*/A|]() - -// @filename: lib/__init__.pyi -// @library: true -//// class A(): ... - -// @filename: lib/__init__.py -// @library: true -//// from ._lib import A - -// @filename: lib/_lib.py -// @library: true -//// from ._type import A as mod_A -//// A = mod_A -//// "doc string for A" - -// @filename: lib/_type.py -// @library: true -//// class A(): pass - -helper.verifyHover('markdown', { - marker1: '```python\nclass A()\n```\n---\ndoc string for A', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.classNoInit.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.classNoInit.fourslash.ts deleted file mode 100644 index 172ee711..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.classNoInit.fourslash.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @filename: test.py -//// class Something: -//// '''This is a test.''' -//// -//// def __init__(self, text: str) -> None: -//// self.text = text -//// -//// [|/*marker1*/Something|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass Something(text: str)\n```\n---\nThis is a test.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.fourslash.ts deleted file mode 100644 index 8b4a9de6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.fourslash.ts +++ /dev/null @@ -1,90 +0,0 @@ -/// - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: module1.py -//// '''module1 docs''' -//// -//// def func1(): -//// '''func1 docs''' -//// return True -//// -//// class A: -//// '''A docs''' -//// def method1(self): -//// '''A.method1 docs''' -//// return True -//// class Inner: -//// '''A.Inner docs''' -//// def method1(self): -//// '''A.Inner.method1 docs''' -//// return True -//// -//// class B: -//// '''B docs''' -//// def __init__(self): -//// '''B init docs''' -//// pass - -// @filename: module1.pyi -//// def func1() -> bool: ... -//// -//// class A: -//// def method1(self) -> bool: ... -//// class Inner: -//// def method1(self) -> bool: ... -//// -//// class B: -//// def __init__(self): ... - -// @filename: module2/__init__.py -// @library: true -//// '''module2 docs''' -//// -//// from ._internal import func2 - -// @filename: module2/_internal.py -// @library: true -//// from ._more_internal import func2 - -// @filename: module2/_more_internal.py -// @library: true -//// def func2(): -//// '''func2 docs''' -//// return True - -// @filename: typings/module2.pyi -//// def func2() -> bool: ... - -// @filename: test.py -//// import [|/*module1_docs*/module1|] as m1 -//// import [|/*module2_docs*/module2|] as m2 -//// -//// print([|/*m1_docs*/m1|].[|/*func1_docs*/func1|]()) -//// -//// a = m1.[|/*a_docs*/A|]() -//// print(a.[|/*method1_docs*/method1|]()) -//// -//// b = m1.[|/*b_docs*/B|]() -//// -//// print([|/*m2_docs*/m2|].[|/*func2_docs*/func2|]()) -//// -//// inner = m1.A.[|/*a_inner_docs*/Inner|]() -//// print(inner.[|/*inner_method1_docs*/method1|]()) - -helper.verifyHover('markdown', { - a_docs: '```python\nclass A()\n```\n---\nA docs', - b_docs: '```python\nclass B()\n```\n---\nB init docs', - a_inner_docs: '```python\nclass Inner()\n```\n---\nA.Inner docs', - func1_docs: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', - func2_docs: '```python\n(function) def func2() -> bool\n```\n---\nfunc2 docs', - inner_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.Inner.method1 docs', - method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.method1 docs', - module1_docs: '```python\n(module) module1\n```\n---\nmodule1 docs', - module2_docs: '```python\n(module) module2\n```\n---\nmodule2 docs', - m1_docs: '```python\n(module) m1\n```\n---\nmodule1 docs', - m2_docs: '```python\n(module) m2\n```\n---\nmodule2 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.ts deleted file mode 100644 index 2a46e058..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @filename: package1/__init__.py -// @library: true -//// from .subpackage import func1 - -// @filename: package1/subpackage.py -// @library: true -//// def func1(): -//// '''func1 docs''' -//// return True - -// @filename: typings/package1/__init__.pyi -//// from .subpackage import func1 as func1 - -// @filename: typings/package1/subpackage/__init__.pyi -//// def func1() -> bool: ... - -// @filename: test.py -//// from package1 import func1 -//// -//// print([|/*func1_docs*/func1|]()) - -helper.verifyHover('markdown', { - func1_docs: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.ts deleted file mode 100644 index 495e3ef2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @filename: package1/__init__.py -// @library: true -//// '''package1 docs''' -//// from .subpackage import func1 - -// @filename: package1/subpackage/__init__.py -// @library: true -//// '''subpackage docs''' -//// def func1(): -//// '''func1 docs''' -//// return True - -// @filename: typings/package1/__init__.pyi -//// from .subpackage import func1 as func1 - -// @filename: typings/package1/subpackage.pyi -//// def func1() -> bool: ... - -// @filename: test.py -//// from [|/*package_docs*/package1|] import func1 -//// -//// print([|/*func1_docs*/func1|]()) - -helper.verifyHover('markdown', { - func1_docs: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', - package_docs: '```python\n(module) package1\n```\n---\npackage1 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.ts deleted file mode 100644 index 1263c9ee..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -// @filename: module1.py -//// '''module1 docs''' -//// -//// def func1(): -//// '''func1 docs''' -//// return True -//// - -// @filename: module1.pyi -//// def func1() -> bool: ... -//// - -// @filename: test.py -//// from . import module1 -//// -//// print([|/*module1_docs*/module1|].[|/*func1_docs*/func1|]()) - -helper.verifyHover('markdown', { - func1_docs: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', - module1_docs: '```python\n(module) module1\n```\n---\nmodule1 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.ts deleted file mode 100644 index aa8ce2d6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -// @filename: module1.py -//// '''module1 docs''' -//// -//// def func1(): -//// '''func1 docs''' -//// return True -//// - -// @filename: module1.pyi -//// def func1() -> bool: ... -//// - -// @filename: test.py -//// from .[|/*module_docs*/module1|] import func1 -//// -//// print([|/*func1_docs*/func1|]()) - -helper.verifyHover('markdown', { - func1_docs: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', - module_docs: '```python\n(module) module1\n```\n---\nmodule1 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.ts deleted file mode 100644 index 718c9361..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.ts +++ /dev/null @@ -1,53 +0,0 @@ -/// - -// @filename: dj/__init__.py -// @library: true -//// '''dj doc string''' -//// # empty - -// @filename: dj/db/__init__.py -// @library: true -//// '''db doc string''' -//// # empty - -// @filename: dj/db/models/__init__.py -// @library: true -//// '''models doc string''' -//// from dj.db.models.base import Model - -// @filename: dj/db/models/base.py -// @library: true -//// class Model: -//// def clean_fields(self): -//// '''clean_fields docs''' -//// pass - -// @filename: typings/dj/__init__.pyi -//// # empty - -// @filename: typings/dj/db/__init__.pyi -//// # empty - -// @filename: typings/dj/db/models/__init__.pyi -//// '''models doc string''' -//// from .base import Model as Model - -// @filename: typings/dj/db/models/base.pyi -//// class Model: -//// def clean_fields(self) -> None: ... - -// @filename: test.py -//// from [|/*djmarker*/dj|].[|/*dbmarker*/db|] import [|/*modelsmarker*/models|] -//// -//// class Person(models.Model): -//// pass -//// -//// p = Person() -//// p.[|/*marker*/clean_fields|]() - -helper.verifyHover('markdown', { - marker: '```python\n(method) def clean_fields() -> None\n```\n---\nclean\\_fields docs', - djmarker: '```python\n(module) dj\n```\n---\ndj doc string', - dbmarker: '```python\n(module) db\n```\n---\ndb doc string', - modelsmarker: '```python\n(module) models\n```\n---\nmodels doc string', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.ts deleted file mode 100644 index dfabeefe..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// - -// @filename: test.py - -//// # empty string -//// [|/*marker1*/emptySingleQuotes|]= '' -//// [|/*marker2*/emptyDoubleQuotes|]= "" -//// [|/*marker3*/emptyTripleQuotes|]= '''''' -//// [|/*marker4*/emptyTripleDoubleQuotes|]= """""" - -//// # simple string -//// [|/*marker5*/simpleSingleQuotes|]= 'a' -//// [|/*marker6*/simpleDoubleQuotes|]= "b" -//// [|/*marker7*/simpleTripleQuotes|]= '''foo\nbar''' -//// [|/*marker8*/simpleTripleDoubleQuotes|]= """foo\nbar""" - -//// # escaped quotes -//// [|/*marker9*/singleQuotesWithEscapedQuote|]= '\'' -//// [|/*marker10*/doubleQuotesWithEscapedQuote|]= "\"" -//// [|/*marker11*/tripleQuotesWithEscapedQuote|]= '''\n\'\'\'''' -//// [|/*marker12*/tripleDoubleQuotesWithEscapedQuote|]= """\n\"\"\"""" - -//// # mixing quotes -//// [|/*marker13*/singleQuotesWithDouble|]= '"' -//// [|/*marker14*/singleQuotesWithTripleDouble|]= '"""' -//// [|/*marker15*/singleTripleQuoteWithSingleAndDoubleQuote|]= ''' '"' ''' - -//// # multiline (truncated) -//// const [|/*marker16*/html|] = '''\nTitle''' -//// const [|/*marker17*/htmlWithSingleQuotes|] = '''\nTitle's''' -//// const [|/*marker18*/htmlWithTripleEscapedQuotes|] = '''\nTitle\'\'\'s''' - -helper.verifyHover('markdown', { - marker1: `\`\`\`python\n(variable) emptySingleQuotes: Literal['']\n\`\`\``, - marker2: `\`\`\`python\n(variable) emptyDoubleQuotes: Literal['']\n\`\`\``, - marker3: `\`\`\`python\n(variable) emptyTripleQuotes: Literal['']\n\`\`\``, - marker4: `\`\`\`python\n(variable) emptyTripleDoubleQuotes: Literal['']\n\`\`\``, - marker5: `\`\`\`python\n(variable) simpleSingleQuotes: Literal['a']\n\`\`\``, - marker6: `\`\`\`python\n(variable) simpleDoubleQuotes: Literal['b']\n\`\`\``, - marker7: `\`\`\`python\n(variable) simpleTripleQuotes: Literal['foo\\nbar']\n\`\`\``, - marker8: `\`\`\`python\n(variable) simpleTripleDoubleQuotes: Literal['foo\\nbar']\n\`\`\``, - marker9: `\`\`\`python\n(variable) singleQuotesWithEscapedQuote: Literal['\\\'']\n\`\`\``, - marker10: `\`\`\`python\n(variable) doubleQuotesWithEscapedQuote: Literal['"']\n\`\`\``, - marker11: `\`\`\`python\n(variable) tripleQuotesWithEscapedQuote: Literal['\\n\\'\\'\\'']\n\`\`\``, - marker12: `\`\`\`python\n(variable) tripleDoubleQuotesWithEscapedQuote: Literal['\\n"""']\n\`\`\``, - marker13: `\`\`\`python\n(variable) singleQuotesWithDouble: Literal['"']\n\`\`\``, - marker14: `\`\`\`python\n(variable) singleQuotesWithTripleDouble: Literal['"""']\n\`\`\``, - marker15: `\`\`\`python\n(variable) singleTripleQuoteWithSingleAndDoubleQuote: Literal[' \\'"\\' ']\n\`\`\``, - marker16: `\`\`\`python\n(variable) html: Literal['\\nTitle…']\n\`\`\``, - marker17: `\`\`\`python\n(variable) htmlWithSingleQuotes: Literal['<!DOCTYPE html><html lang="en">\\n<head><title>Title…']\n\`\`\``, - marker18: `\`\`\`python\n(variable) htmlWithTripleEscapedQuotes: Literal['<!DOCTYPE html><html lang="en">\\n<head><title>Title…']\n\`\`\``, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.ts deleted file mode 100644 index bc71e650..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: package1-stubs/__init__.pyi -// @library: true -//// from .api import func1 as func1 - -// @filename: package1-stubs/api.pyi -// @library: true -//// def func1() -> bool: ... - -// @filename: package1/__init__.py -// @library: true -//// from .api import func1 as func1 - -// @filename: package1/api.py -// @library: true -//// def func1(): -//// '''func1 docs''' -//// return True - -// @filename: test.py -//// import package1 -//// -//// print(package1.[|/*marker*/func1|]()) - -helper.verifyHover('markdown', { - marker: '```python\n(function) def func1() -> bool\n```\n---\nfunc1 docs', - marker2: '```python\n(function) def func2() -> bool\n```\n---\nfunc2 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.typeshed.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.typeshed.fourslash.ts deleted file mode 100644 index eae24f8d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docFromSrc.typeshed.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: requests/__init__.pyi -// @library: true -//// from .api import head as head - -// @filename: requests/api.pyi -// @library: true -//// def head(url, **kwargs) -> None: -//// r"""Sends a <HEAD> request.""" -//// pass - -// @filename: test.py -//// import requests -//// -//// print(requests.[|/*marker*/head|]('')) - -helper.verifyHover('markdown', { - marker: '```python\n(function) def head(url: Unknown, **kwargs: Unknown) -> None\n```\n---\nSends a <HEAD> request.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.alias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docstring.alias.fourslash.ts deleted file mode 100644 index 5d7c78ee..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.alias.fourslash.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class ClassA: -//// ''' ClassA doc string ''' -//// pass -//// -//// [|/*marker1*/AliasA|] = ClassA -//// ''' AliasA doc string ''' -//// -//// def func1(x: [|/*marker2*/AliasA|]): -//// pass -//// -//// class ClassB: -//// pass -//// -//// [|/*marker3*/AliasB|] = ClassB -//// ''' AliasB alone doc string ''' -//// -//// class ClassC: -//// """ ClassC doc string """ -//// pass -//// -//// [|/*marker4*/AliasC|] = ClassC -//// ''' AliasC doc string ''' -//// -//// class ClassD: -//// pass -//// -//// [|/*marker5*/AliasD|] = ClassD -//// ''' AliasD alone doc string ''' -//// - -helper.verifyHover('markdown', { - marker1: '```python\n(type) AliasA = ClassA\n```\n---\nAliasA doc string\n\nClassA doc string', - marker2: '```python\n(type) AliasA = ClassA\n```\n---\nAliasA doc string\n\nClassA doc string', - marker3: '```python\n(type) AliasB = ClassB\n```\n---\nAliasB alone doc string', - marker4: '```python\n(type) AliasC = ClassC\n```\n---\nAliasC doc string\n\nClassC doc string', - marker5: '```python\n(type) AliasD = ClassD\n```\n---\nAliasD alone doc string', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.links.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docstring.links.fourslash.ts deleted file mode 100644 index bcd49d73..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.links.fourslash.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// def func(): -//// '''something [link](http://microsoft.com) something''' -//// pass -//// -//// [|/*marker1*/func|]() - -helper.verifyHover('markdown', { - marker1: '```python\n(function) def func() -> None\n```\n---\nsomething [link](http://microsoft.com) something', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.overloads.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docstring.overloads.fourslash.ts deleted file mode 100644 index c2994037..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.overloads.fourslash.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker1*/dontwork|] -//// mylib.[|/*marker2*/works|] - -// @filename: mylib/__init__.pyi -//// from typing import overload -//// -//// class RandomState: -//// @overload -//// def dontwork(self, x:int) -> None: ... -//// @overload -//// def dontwork(self, x:float) -> None: ... -//// def works(self) -> None: ... -//// -//// _rand = RandomState -//// -//// dontwork = _rand.dontwork -//// works = _rand.works - -// @filename: mylib/__init__.py -//// from typing import Union, overload -//// -//// class RandomState: -//// @overload -//// def dontwork(self, x:int) -> None: ... -//// def dontwork(self, x:Union[int, float]) -> None: -//// 'dontwork docstring' -//// ... -//// def works(self) -> None: -//// 'works docstring' -//// ... - -helper.verifyHover('markdown', { - marker1: - '```python\n(variable)\ndef dontwork(self: _rand, x: int) -> None: ...\ndef dontwork(self: _rand, x: float) -> None: ...\n```\n---\ndontwork docstring', - marker2: '```python\n(variable) def works(self: _rand) -> None\n```\n---\nworks docstring', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.parameter.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docstring.parameter.fourslash.ts deleted file mode 100644 index b5b1aa3c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.parameter.fourslash.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// def foo1([|/*marker1*/bar|]: str) -> None: -//// """ -//// Foo1 does something -//// -//// @param bar: The bar is in town -//// """ -//// baz = [|/*marker2*/bar|] -//// ... -//// -//// def foo2([|/*marker3*/bar|]: str) -> None: -//// """ -//// Foo2 does something -//// -//// :param bar: The bar is in town -//// """ -//// baz = [|/*marker4*/bar|] -//// ... -//// -//// def foo3([|/*marker5*/bar|]: str, [|/*marker6*/bar2|]: str) -> None: -//// """ -//// Foo3 does something -//// -//// Args: -//// bar: The bar is in town -//// bar2 The bar is 2 far -//// """ -//// baz = [|/*marker7*/bar|] -//// [|/*marker8*/bar|] = "reassign" -//// ... -//// -//// def foo4([|/*marker9*/bar|]: str, [|/*marker10*/bar2|]: str) -> None: -//// """ -//// Foo4 does something -//// -//// Args: -//// bar (str): The bar is in town -//// bar2 str: The bar is 2 far -//// """ -//// baz = [|/*marker11*/bar|] -//// ... - -helper.verifyHover('markdown', { - marker1: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker2: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker3: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker4: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker5: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker6: '```python\n(parameter) bar2: str\n```', - marker7: '```python\n(parameter) bar: str\n```\nbar: The bar is in town', - marker8: "```python\n(parameter) bar: Literal['reassign']\n```\nbar: The bar is in town", - marker9: '```python\n(parameter) bar: str\n```\nbar (str): The bar is in town', - marker10: '```python\n(parameter) bar2: str\n```', - marker11: '```python\n(parameter) bar: str\n```\nbar (str): The bar is in town', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.split.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.docstring.split.fourslash.ts deleted file mode 100644 index 50257511..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.docstring.split.fourslash.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// def func(): -//// '''This docstring ''' '''is split.''' -//// pass -//// -//// def func2(): -//// f'''This docstring ''' '''is split.''' -//// pass -//// -//// def func3(): -//// '''This docstring ''' f'''is split.''' -//// pass -//// -//// def func4(a:int, b:int, c:int): -//// """ -//// Args: -//// a (int): description -//// b (int|bool): 한국어 -//// c (int): description -//// """ -//// -//// [|/*marker1*/func|]() -//// [|/*marker2*/func2|]() -//// [|/*marker3*/func3|]() -//// [|/*marker4*/func4|]() - -helper.verifyHover('markdown', { - marker1: '```python\n(function) def func() -> None\n```\n---\nThis docstring is split.', - marker2: '```python\n(function) def func2() -> None\n```', - marker3: '```python\n(function) def func3() -> None\n```', - marker4: - '```python\n(function) def func4(a: int, b: int, c: int) -> None\n```\n---\nArgs: \n    a (int): description \n    b (int|bool): 한국어 \n    c (int): description', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.basic.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.basic.fourslash.ts deleted file mode 100644 index 18439e85..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.basic.fourslash.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class Foo: -//// def __new__(cls, name:str): -//// '''doc for __new__.''' -//// return super().__new__(cls) -//// -//// x = [|/*marker1*/Foo|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass Foo(name: str)\n```\n---\ndoc for \\_\\_new\\_\\_.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance.fourslash.ts deleted file mode 100644 index 845cc46e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance.fourslash.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class Parent: -//// def __init__(self, *args: Any, **kwargs: Any): -//// pass -//// -//// class Child(Parent): -//// def __new__(cls, name: str): -//// return super().__new__(cls) - -//// x = [|/*marker1*/Child|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass Child(name: str)\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance2.fourslash.ts deleted file mode 100644 index d37c4818..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.inheritance2.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class Parent: -//// def __init__(self, *args: Any, **kwargs: Any): -//// pass -//// -//// def __new__(cls, *args: Any, **kwargs: Any): -//// return super().__new__(cls) -//// -//// class Child(Parent): -//// def __new__(cls, name:str): -//// return super().__new__(cls, name) -//// -//// class GrandChild(Child): -//// pass - -//// x = [|/*marker1*/GrandChild|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass GrandChild(name: str)\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.overloads.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.overloads.fourslash.ts deleted file mode 100644 index e226d26e..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.overloads.fourslash.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import overload -//// class Foo: -//// @overload -//// def __new__(cls, name:str, last:str) -> "Foo": -//// return super().__new__(cls) -//// @overload -//// def __new__(cls, age:int, height:float) -> "Foo": -//// return super().__new__(cls) -//// -//// x = [|/*marker1*/Foo|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass Foo(name: str, last: str): ...\n\nclass Foo(age: int, height: float): ...\n\n\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.withInit.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.withInit.fourslash.ts deleted file mode 100644 index 56e13eea..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.dunderNew.withInit.fourslash.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class Foo: -//// def __init__(self, *args: Any, **kwargs: Any): -//// pass -//// def __new__(cls, name:str): -//// '''doc for __new__.''' -//// return super().__new__(cls) -//// -//// x = [|/*marker1*/Foo|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass Foo(name: str)\n```\n---\ndoc for \\_\\_new\\_\\_.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.formatted.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.formatted.fourslash.ts deleted file mode 100644 index 0f2b51b0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.formatted.fourslash.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "functionSignatureDisplay": "formatted" -//// } - -// @filename: test.py -//// from typing import overload -//// class A: -//// def __init__(self, x:int, y:int): -//// pass -//// -//// class B: -//// @overload -//// def __init__(self): -//// pass -//// @overload -//// def __init__(self, x:int, y:int): -//// pass -//// -//// a = [|/*a_constructor*/A|](1,2) -//// -//// b = [|/*b_constructorOverloads*/B|](1,2) -//// def [|/*paramFunc0*/foo|](): -//// pass -//// def [|/*paramFunc1*/foo1|](x:int): -//// pass -//// def [|/*paramFunc2*/foo2|](x:int, y:int): -//// pass -//// -//// @overload -//// def bar() -> int: ... -//// @overload -//// def bar(x:str, y:int) -> int: ... -//// -//// [|/*overload*/bar|] - -helper.verifyHover('markdown', { - a_constructor: '```python\nclass A(\n x: int,\n y: int\n)\n```', - b_constructorOverloads: '```python\nclass B(\n x: int,\n y: int\n)\n```', - paramFunc0: '```python\n(function) def foo() -> None\n```', - paramFunc1: '```python\n(function) def foo1(x: int) -> None\n```', - paramFunc2: '```python\n(function) def foo2(\n x: int,\n y: int\n) -> None\n```', - overload: '```python\n(function)\ndef bar() -> int: ...\ndef bar(\n x: str,\n y: int\n) -> int: ...\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.fourslash.ts deleted file mode 100644 index 12ae1327..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class [|/*marker1*/Validator|]: -//// '''The validator class -//// -//// .. versionadded:: 2.0 -//// This directive does not show in hover. -//// ''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// return true -//// -//// validator = Validator() -//// validator.[|/*marker2*/is_valid|]('hello') - -helper.verifyHover('markdown', { - marker1: '```python\n(class) Validator\n```\n---\nThe validator class', - marker2: '```python\n(method) def is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.import.django.view.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.import.django.view.fourslash.ts deleted file mode 100644 index 8f8274aa..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.import.django.view.fourslash.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from django.view import generic -//// generic.[|/*marker*/TemplateView|] - -// @filename: django/__init__.py -//// '''documentation for library''' - -// @filename: django/view/__init__.py -//// from .generic.base import View -//// __all__ = ['View'] - -// @filename: django/view/generic/__init__.py -//// from .base import (View, TemplateView) -//// __all__ = ['View', 'TemplateView'] - -// @filename: django/view/generic/base.py -//// class View(): -//// pass -//// -//// class TemplateView(): -//// pass - -helper.verifyHover('markdown', { - marker: '```python\n(class) TemplateView\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.import.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.import.fourslash.ts deleted file mode 100644 index 76697fe7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.import.fourslash.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// import [|/*marker*/library|] - -// @filename: library/__init__.py -//// '''documentation for library''' - -helper.verifyHover('markdown', { - marker: '```python\n(module) library\n```\n---\ndocumentation for library', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inferred.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inferred.fourslash.ts deleted file mode 100644 index 7501e799..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inferred.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// import third_party_module # type: ignore -//// -//// def return_one(): -//// one = third_party_module.one() -//// if one is None: -//// return -//// return one -//// -//// def return_two() -> int: -//// [|on/*marker1*/e|]: int | None = return_one() -//// assert one is not None -//// two = [|on/*marker2*/e|] + 1 -//// return two -//// -//// [|tw/*marker3*/o|] = return_two() -helper.verifyHover('markdown', { - marker1: '```python\n(variable) one: Unknown | None\n```', - marker2: '```python\n(variable) one: Unknown\n```', - marker3: '```python\n(variable) two: int\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrc.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrc.fourslash.ts deleted file mode 100644 index 92e1c80d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrc.fourslash.ts +++ /dev/null @@ -1,63 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: module1.py -//// '''module1 docs''' -//// -//// def func1(): -//// '''func1 docs''' -//// return True -//// -//// class A: -//// '''A docs''' -//// def method1(self) -> bool: -//// '''A.method1 docs''' -//// return True -//// -//// class B: -//// '''B docs''' -//// def __init__(self): -//// '''B init docs''' -//// pass - -// @filename: testBasicInheritance.py -//// import module1 -//// -//// class ChildA(module1.A): -//// def method1(self) -> bool: -//// return True -//// -//// class ChildB(module1.B): -//// def __init__(self): -//// pass -//// -//// childA =[|/*child_a_docs*/ChildA|]() -//// childA.[|/*child_a_method1_docs*/method1|]() -//// -//// childB =[|/*child_b_docs*/ChildB|]() -//// childB.[|/*child_b_init_docs*/__init__|]() - -// @filename: testMultiLevelInheritance.py -//// class Base: -//// """Base docs""" -//// def method(self): -//// """Base.method docs""" -//// -//// class Derived1(Base): -//// def method(self): -//// pass -//// -//// class Derived2(Derived1): -//// def method(self): -//// pass -//// -//// d2 = [|/*secondDerived_docs*/Derived2|]() -//// d2.[|/*secondDerived_method_docs*/method|]() - -helper.verifyHover('markdown', { - child_a_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.method1 docs', - child_a_docs: '```python\nclass ChildA()\n```', - child_b_docs: '```python\nclass ChildB()\n```\n---\nB init docs', - child_b_init_docs: '```python\n(method) def __init__() -> None\n```\n---\nB init docs', - secondDerived_docs: '```python\nclass Derived2()\n```', - secondDerived_method_docs: '```python\n(method) def method() -> None\n```\n---\nBase.method docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.ts deleted file mode 100644 index 14a60a87..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.ts +++ /dev/null @@ -1,54 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: module1.py -//// class A: -//// '''A docs''' -//// def method1(self): -//// '''A.method1 docs''' -//// return True -//// class Inner: -//// '''A.Inner docs''' -//// def method1(self): -//// '''A.Inner.method1 docs''' -//// return True -//// -//// class NoFields: -//// '''NoFields docs''' - -// @filename: module1.pyi -//// class A: -//// def method1(self) -> bool:... -//// class Inner: -//// def method1(self) -> bool: ... -//// -//// class NoFields:... - -// @filename: testInheritedDocsInSource.py -//// import module1 -//// class ChildA(module1.A): -//// def method1(self) -> bool: -//// return True -//// class ChildInner(module1.A.Inner): -//// def method1(self) -> bool: -//// return True -//// -//// childA =[|/*child_a_docs*/ChildA|]() -//// childA.[|/*child_a_method1_docs*/method1|]() -//// -//// inner =ChildA.[|/*child_a_inner_docs*/ChildInner|]() -//// inner.[|/*child_a_inner_method1_docs*/method1|]() - -// @filename: testInheritedClassNoFieldsDocsInSource.py -//// import module1 -//// class ChildB(module1.NoFields): -//// pass -//// -//// childB =[|/*child_b_docs*/ChildB|]() - -helper.verifyHover('markdown', { - child_a_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.method1 docs', - child_a_docs: '```python\nclass ChildA()\n```', - child_a_inner_docs: '```python\nclass ChildInner()\n```', - child_a_inner_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.Inner.method1 docs', - child_b_docs: '```python\nclass ChildB()\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromStub.fourslash.ts deleted file mode 100644 index ae7a355f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.docFromStub.fourslash.ts +++ /dev/null @@ -1,42 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: module1.py -//// class A: -//// def method1(self) -> bool: -//// return True -//// class Inner: -//// def method1(self): -//// return True - -// @filename: module1.pyi -//// class A: -//// '''A docs''' -//// def method1(self) -> bool: -//// '''A.method1 docs''' -//// ... -//// class Inner: -//// '''A.Inner docs''' -//// def method1(self) -> bool: -//// '''A.Inner.method1 docs''' -//// ... - -// @filename: testInheritedDocsInStubs.py -//// import module1 -//// class ChildA(module1.A): -//// def method1(self) -> bool: -//// return True -//// class ChildInner(module1.A.Inner): -//// def method1(self) -> bool: -//// return True -//// -//// childA =[|/*child_a_docs*/ChildA|]() -//// childA.[|/*child_a_method1_docs*/method1|]() -//// inner =ChildA.[|/*child_a_inner_docs*/ChildInner|]() -//// inner.[|/*child_a_inner_method1_docs*/method1|]() - -helper.verifyHover('markdown', { - child_a_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.method1 docs', - child_a_docs: '```python\nclass ChildA()\n```', - child_a_inner_docs: '```python\nclass ChildInner()\n```', - child_a_inner_method1_docs: '```python\n(method) def method1() -> bool\n```\n---\nA.Inner.method1 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.ts deleted file mode 100644 index 127a0c70..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: overloads_client.py -//// from typing import overload -//// import moduleA -//// -//// class ChildA(moduleA.A): -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass -//// -//// -//// ChildA.[|/*child_a_func_doc*/func|] -//// a = ChildA() -//// a.[|/*child_a_instance_func_doc*/func|] - -// @filename: typings/moduleA.pyi -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: ... -//// -//// @overload -//// def func(self, x: int) -> int: ... - -// @filename: typings/moduleA.py -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// '''func docs''' -//// pass - -helper.verifyHover('markdown', { - child_a_func_doc: - '```python\n(method)\ndef func(self: ChildA, x: str) -> str: ...\ndef func(self: ChildA, x: int) -> int: ...\n```\n---\nfunc docs', - child_a_instance_func_doc: - '```python\n(method)\ndef func(x: str) -> str: ...\ndef func(x: int) -> int: ...\n```\n---\nfunc docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.ts deleted file mode 100644 index 952e8062..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: overloads_client.py -//// from typing import overload -//// import moduleA -//// -//// class ChildA(moduleA.A): -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass -//// -//// -//// ChildA.[|/*child_a_func_doc*/func|] -//// a = ChildA() -//// a.[|/*child_a_instance_func_doc*/func|] - -// @filename: typings/moduleA.pyi -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: ... -//// -//// @overload -//// def func(self, x: int) -> int: -//// '''func docs''' -//// ... - -// @filename: typings/moduleA.py -//// from typing import overload -//// class A: -//// @overload -//// def func(self, x: str) -> str: -//// pass -//// -//// @overload -//// def func(self, x: int) -> int: -//// pass - -helper.verifyHover('markdown', { - child_a_func_doc: - '```python\n(method)\ndef func(self: ChildA, x: str) -> str: ...\ndef func(self: ChildA, x: int) -> int: ...\n```\n---\nfunc docs', - child_a_instance_func_doc: - '```python\n(method)\ndef func(x: str) -> str: ...\ndef func(x: int) -> int: ...\n```\n---\nfunc docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.ts deleted file mode 100644 index 86c23aff..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.ts +++ /dev/null @@ -1,87 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// class ChildGetterDocs(testLib.ClassWithGetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ChildSetterDocs(testLib.ClassWithSetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// one = ChildGetterDocs(3) -//// one.[|/*getter_docs*/length|] -//// two = ChildSetterDocs(3) -//// two.[|/*setter_docs*/length|] - -// @filename: testLib/__init__.py -//// class ClassWithGetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// """ -//// read property doc -//// """ -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ClassWithSetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// """ -//// setter property doc -//// """ -//// pass -//// - -// @filename: testLib/__init__.pyi -//// class ClassWithGetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: ... -//// -//// class ClassWithSetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: ... - -helper.verifyHover('markdown', { - getter_docs: '```python\n(property) length: int\n```\n---\nread property doc', - setter_docs: '```python\n(property) length: int\n```\n---\nsetter property doc', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromStub.fourslash.ts deleted file mode 100644 index b2fe96db..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.inherited.property.docFromStub.fourslash.ts +++ /dev/null @@ -1,91 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import testLib -//// class ChildGetterDocs(testLib.ClassWithGetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ChildSetterDocs(testLib.ClassWithSetterDocs): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// one = ChildGetterDocs(3) -//// one.[|/*getter_docs*/length|] -//// two = ChildSetterDocs(3) -//// two.[|/*setter_docs*/length|] - -// @filename: testLib/__init__.py -// @library: true -//// class ClassWithGetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// -//// class ClassWithSetterDocs(object): -//// def __init__(self, length): -//// self._length = length -//// -//// @property -//// def length(self): -//// return self._length -//// -//// @length.setter -//// def length(self, value): -//// pass -//// - -// @filename: testLib/__init__.pyi -// @library: true -//// class ClassWithGetterDocs(object): -//// @property -//// def length(self) -> int: -//// """ -//// read property doc -//// """ -//// ... -//// @length.setter -//// def length(self, value) -> None: ... -//// -//// class ClassWithSetterDocs(object): -//// @property -//// def length(self) -> int: ... -//// @length.setter -//// def length(self, value) -> None: -//// """ -//// setter property doc -//// """ -//// ... - -helper.verifyHover('markdown', { - getter_docs: '```python\n(property) length: int\n```\n---\nread property doc', - setter_docs: '```python\n(property) length: int\n```\n---\nsetter property doc', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.init.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.init.fourslash.ts deleted file mode 100644 index f225c23b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.init.fourslash.ts +++ /dev/null @@ -1,39 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import Generic, TypeVar, Union -//// -//// class C1: -//// def __init__(self, name="hello"): -//// '''__init__ docs''' -//// pass -//// -//// class C2: -//// def __init__(self, name="hello"): -//// pass -//// -//// c1 = [|/*marker1*/C1|]() -//// -//// unionType = Union[C1, C2] -//// c2 = [|/*marker2*/unionType|] -//// -//// T = TypeVar("T") -//// class G(Generic[T]): -//// def __init__(self, value: T): -//// pass -//// -//// g1 = [|/*marker3*/G|](10) -//// g2 = [|/*marker4*/G|][int](10) - -// @filename: test1.py -//// import test -//// -//// c = test.[|/*marker5*/C1|]() - -helper.verifyHover('markdown', { - marker1: '```python\nclass C1(name: str = "hello")\n```\n---\n\\_\\_init\\_\\_ docs', - marker2: '```python\n(type) unionType = C1 | C2\n```', - marker3: '```python\nclass G(value: int)\n```', - marker4: '```python\nclass G(value: int)\n```', - marker5: '```python\nclass C1(name: str = "hello")\n```\n---\n\\_\\_init\\_\\_ docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.libCodeAndStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.libCodeAndStub.fourslash.ts deleted file mode 100644 index 15a63a9d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.libCodeAndStub.fourslash.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib/__init__.py -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text): -//// '''Checks if the input string is valid.''' -//// return True -//// @property -//// def read_only_prop(self): -//// '''The read-only property.''' -//// return True -//// @property -//// def read_write_prop(self): -//// '''The read-write property.''' -//// return True -//// @read_write_prop.setter -//// def read_write_prop(self, val): -//// pass - -// @filename: testLib/__init__.pyi -// @library: true -//// class Validator: -//// def is_valid(self, text: str) -> bool: ... -//// @property -//// def read_only_prop(self) -> bool: ... -//// @property -//// def read_write_prop(self) -> bool: ... -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): ... - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.[|/*marker2*/is_valid|]('') -//// obj.[|/*marker3*/read_only_prop|] -//// r = obj.[|/*marker4*/read_write_prop|] -//// obj.[|/*marker5*/read_write_prop|] = r - -helper.verifyHover('markdown', { - marker1: '```python\nclass Validator()\n```\n---\nThe validator class', - marker2: '```python\n(method) def is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - marker3: '```python\n(property) read_only_prop: bool\n```\n---\nThe read-only property.', - marker4: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', - marker5: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.libCodeNoStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.libCodeNoStub.fourslash.ts deleted file mode 100644 index c1a8b1e3..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.libCodeNoStub.fourslash.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib/__init__.py -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// return True -//// @property -//// def read_only_prop(self) -> bool: -//// '''The read-only property.''' -//// return True -//// @property -//// def read_write_prop(self) -> bool: -//// '''The read-write property.''' -//// return True -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): -//// pass - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.[|/*marker2*/is_valid|]('') -//// obj.[|/*marker3*/read_only_prop|] -//// r = obj.[|/*marker4*/read_write_prop|] -//// obj.[|/*marker5*/read_write_prop|] = r - -helper.verifyHover('markdown', { - marker1: '```python\nclass Validator()\n```\n---\nThe validator class', - marker2: '```python\n(method) def is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - marker3: '```python\n(property) read_only_prop: bool\n```\n---\nThe read-only property.', - marker4: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', - marker5: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.libStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.libStub.fourslash.ts deleted file mode 100644 index a4dc480d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.libStub.fourslash.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib/__init__.pyi -// @library: true -//// class Validator: -//// '''The validator class''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// pass -//// @property -//// def read_only_prop(self) -> bool: -//// '''The read-only property.''' -//// pass -//// @property -//// def read_write_prop(self) -> bool: -//// '''The read-write property.''' -//// pass -//// @read_write_prop.setter -//// def read_write_prop(self, val: bool): -//// pass - -// @filename: test.py -//// import testLib -//// obj = testLib.[|/*marker1*/Validator|]() -//// obj.[|/*marker2*/is_valid|]('') -//// obj.[|/*marker3*/read_only_prop|] -//// r = obj.[|/*marker4*/read_write_prop|] -//// obj.[|/*marker5*/read_write_prop|] = r - -helper.verifyHover('markdown', { - marker1: '```python\nclass Validator()\n```\n---\nThe validator class', - marker2: '```python\n(method) def is_valid(text: str) -> bool\n```\n---\nChecks if the input string is valid.', - marker3: '```python\n(property) read_only_prop: bool\n```\n---\nThe read-only property.', - marker4: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', - marker5: '```python\n(property) read_write_prop: bool\n```\n---\nThe read-write property.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.optionalAliasParameter.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.optionalAliasParameter.fourslash.ts deleted file mode 100644 index 445558a7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.optionalAliasParameter.fourslash.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import Literal, Union -//// -//// A = Union[int, str, None] -//// -//// def func([|/*marker1*/param|]: A = None) -> None: -//// print([|/*marker2*/param|]) - -helper.verifyHover('markdown', { - marker1: '```python\n(parameter) param: A\n```', - marker2: '```python\n(parameter) param: A\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.overloadedFunction.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.overloadedFunction.fourslash.ts deleted file mode 100644 index 51586349..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.overloadedFunction.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import overload -//// -//// @overload -//// def func(a: int) -> int: -//// ... -//// -//// @overload -//// def func(a: str) -> str: -//// ... -//// -//// def func(a: int | str) -> int | str: -//// return a -//// -//// [|/*marker1*/func|](1) -//// [|/*marker2*/func|]("hi") - -helper.verifyHover('markdown', { - marker1: '```python\n(function) def func(a: int) -> int\n```', - marker2: '```python\n(function) def func(a: str) -> str\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.plainText.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.plainText.fourslash.ts deleted file mode 100644 index e8387454..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.plainText.fourslash.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class [|/*marker1*/Validator|]: -//// '''The validator class -//// -//// .. versionadded:: 2.0 -//// This directive shows in plaintext. -//// ''' -//// def is_valid(self, text: str) -> bool: -//// '''Checks if the input string is valid.''' -//// return true -//// -//// validator = Validator() -//// validator.[|/*marker2*/is_valid|]('hello') - -helper.verifyHover('plaintext', { - marker1: - '(class) Validator\n\nThe validator class\n\n.. versionadded:: 2.0\n This directive shows in plaintext.', - marker2: '(method) def is_valid(text: str) -> bool\n\nChecks if the input string is valid.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.slots.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.slots.fourslash.ts deleted file mode 100644 index 08659db2..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.slots.fourslash.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class Chat: -//// __slots__ = ("id",) -//// -//// def __init__(self): -//// self.id = 1234 -//// """The ID of the channel.""" -//// -//// y = Chat() -//// y.[|/*marker*/id|] -helper.verifyHover('markdown', { - marker: '```python\n(variable) id: int\n```\n---\nThe ID of the channel.', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.get.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.get.fourslash.ts deleted file mode 100644 index 7314cd60..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.get.fourslash.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing_extensions import TypedDict -//// -//// class Cls(TypedDict): -//// a: int -//// b: str -//// -//// dct: Cls = {"a": 1, "b": "2"} -//// dct.[|/*marker1*/get|]("a") - -helper.verifyHover('markdown', { - marker1: "```python\n(variable) def get(k: Literal['a']) -> int\n```", -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.key.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.key.fourslash.ts deleted file mode 100644 index a567ef79..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.typedDict.key.fourslash.ts +++ /dev/null @@ -1,51 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import TypedDict -//// -//// class User(TypedDict): -//// name: str -//// """The fullname of the User""" -//// -//// age: int -//// """The age of the User, will not be over 200""" -//// -//// views: float -//// -//// user: User = {[|/*marker1*/'name'|]: 'Robert'} -//// -//// def foo(user: User) -> None: -//// ... -//// -//// foo({[|/*marker2*/'name'|]}) -//// foo({[|/*marker3*/'views'|]}) -//// foo({[|/*marker4*/'points'|]}) -//// foo({'name': 'Robert', [|/*marker5*/'age'|]}) -//// foo({'name': 'Robert', [|/*marker6*/'age'|]: 100}) -//// foo({'name': [|/*marker7*/'Robert'|], 'age': 100}) -//// foo({'name': [|/*marker8*/'name'|]}) -//// -//// class Post(TypedDict): -//// title: str -//// age: int -//// """The age of the Post""" -//// -//// def bar(item: Post | User) -> None: -//// ... -//// -//// bar({[|/*marker9*/'title'|]}) -//// bar({[|/*marker10*/'age'|]}) - -helper.verifyHover('markdown', { - marker1: '```python\n(key) name: str\n```\n---\nThe fullname of the User', - marker2: '```python\n(key) name: str\n```\n---\nThe fullname of the User', - marker3: '```python\n(key) views: float\n```', - marker4: null, - marker5: '```python\n(key) age: int\n```\n---\nThe age of the User, will not be over 200', - marker6: '```python\n(key) age: int\n```\n---\nThe age of the User, will not be over 200', - marker7: null, - marker8: null, - marker9: '```python\n(key) title: str\n```', - marker10: - '```python\n(key) age: int\n```\n---\nThe age of the Post\n\n---\n```python\n(key) age: int\n```\n---\nThe age of the User, will not be over 200', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.unpackedTypedDict.key.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.unpackedTypedDict.key.fourslash.ts deleted file mode 100644 index eda8ed99..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.unpackedTypedDict.key.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import TypedDict, Unpack -//// -//// class User(TypedDict): -//// name: str -//// """The fullname of the User""" -//// -//// age: int -//// """The age of the User, will not be over 200""" -//// -//// def foo(**user: Unpack[User]) -> None: -//// ... -//// -//// foo(name='Robert', [|/*marker1*/age|]=100) -//// foo(name='Robert', [|/*marker2*/age|]=) -//// foo([|/*marker3*/name|]='Robert') - -helper.verifyHover('markdown', { - marker1: '```python\n(variable) age: int\n```\n---\nThe age of the User, will not be over 200', - marker2: '```python\n(variable) age: int\n```\n---\nThe age of the User, will not be over 200', - marker3: '```python\n(variable) name: str\n```\n---\nThe fullname of the User', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.variable.docString.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.variable.docString.fourslash.ts deleted file mode 100644 index 695bbea7..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.variable.docString.fourslash.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import Callable -//// class A: -//// def __init__(self, func : Callable[[float], float]) -> None: -//// self.x = 1 -//// """ test x """ -//// self.func = func -//// """A given function""" -//// -//// a = A() -//// a.[|/*marker1*/x|] -//// a.[|/*marker2*/func|] - -// @filename: test2.py -//// y = 2 -//// """ test y """ -//// -//// [|/*marker3*/y|] - -// @filename: test3.py -//// from stubs import z -//// -//// [|/*marker4*/z|] - -// @filename: stubs.py -//// z = 3 -//// """ test z """ - -// @filename: stubs.pyi -//// z: int = ... - -// @filename: test4.py -//// from typing import List, Union -//// [|/*marker5*/SomeType|] = List[Union[int, str]] -//// """Here's some documentation about SomeType""" - -// @filename: testBigInt.py -//// [|/*marker6*/x|] = 123670029844611072 - -helper.verifyHover('markdown', { - marker1: '```python\n(variable) x: int\n```\n---\ntest x', - marker2: '```python\n(variable) def func(float) -> float\n```\n---\nA given function', - marker3: '```python\n(variable) y: Literal[2]\n```\n---\ntest y', - marker4: '```python\n(variable) z: int\n```\n---\ntest z', - marker5: "```python\n(type) SomeType = List[int | str]\n```\n---\nHere's some documentation about SomeType", - marker6: '```python\n(variable) x: Literal[123670029844611072]\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/hover.wildcardimports.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/hover.wildcardimports.fourslash.ts deleted file mode 100644 index 3068c3ba..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/hover.wildcardimports.fourslash.ts +++ /dev/null @@ -1,85 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: lib1/definition.py -// @library: true -//// def func(): -//// '''func docs''' -//// pass -//// -//// class MyType: -//// '''MyType docs''' -//// pass -//// -//// class MyType2: -//// def func2(self): -//// '''func2 docs''' -//// pass - -// @filename: lib1/alias.py -// @library: true -//// def func3(): -//// '''func3 docs''' -//// pass - -// @filename: lib1/withall.py -// @library: true -//// def func4(): -//// '''func4 docs''' -//// pass -//// -//// def func5(): -//// '''func5 docs''' -//// pass -//// -//// __all__ = ['func5'] - -// @filename: lib1/redirect.py -// @library: true -//// from . import withall -//// from .withall import * -//// -//// __all__ += withall.__all__ - -// @filename: lib1/wildcard.py -// @library: true -//// from .definition import * -//// from .redirect import * -//// from .alias import func3 - -// @filename: lib1/__init__.py -// @library: true -//// from .wildcard import * - -// @filename: lib1/__init__.pyi -// @library: true -//// from typing import Any -//// func: Any -//// MyType: Any -//// class MyType2: -//// def func2(self) -> None : ... -//// func3: Any -//// func4: Any -//// func5: Any - -// @filename: test.py -//// import lib1 -//// lib1.[|/*marker1*/func|]() -//// c = lib1.[|/*marker2*/MyType|]() -//// lib1.MyType2().[|/*marker3*/func2|]() -//// lib1.[|/*marker4*/func3|]() -//// lib1.[|/*marker5*/func4|]() -//// lib1.[|/*marker6*/func5|]() - -helper.verifyHover('markdown', { - marker1: '```python\n(variable) func: Any\n```\n---\nfunc docs', - marker2: '```python\n(variable) MyType: Any\n```\n---\nMyType docs', - marker3: '```python\n(method) def func2() -> None\n```\n---\nfunc2 docs', - marker4: '```python\n(variable) func3: Any\n```\n---\nfunc3 docs', - marker5: '```python\n(variable) func4: Any\n```\n---\nfunc4 docs', - marker6: '```python\n(variable) func5: Any\n```\n---\nfunc5 docs', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.multipart.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.multipart.fourslash.ts deleted file mode 100644 index 4aaf8820..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.multipart.fourslash.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: pkg/__init__.py -//// from . import util - -// @filename: pkg/util/__init__.py -//// - -// @filename: pkg/util/foo.py -//// class Foo: -//// pass - -// @filename: test.py -//// import pkg -//// import pkg.util.foo -//// pkg.util.foo.[|/*marker*/Foo|]() - -// @ts-ignore -helper.verifyHover('markdown', { - marker: '```python\nclass Foo()\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.multipart2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.multipart2.fourslash.ts deleted file mode 100644 index 91d32d6b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.multipart2.fourslash.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: pkg/__init__.py -//// from . import sub1 -//// from .sub2 import * - -// @filename: pkg/sub1.py -//// a = 1 -//// b = 2 - -// @filename: pkg/sub2.py -//// from . import sub1 -//// from .sub1 import a - -// @filename: test.py -//// import pkg.sub1 -//// pkg.sub1.[|/*marker*/b|]() - -// @ts-ignore -helper.verifyHover('markdown', { - marker: '```python\n(variable) b: int\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.multipart3.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.multipart3.fourslash.ts deleted file mode 100644 index 3e0e1772..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.multipart3.fourslash.ts +++ /dev/null @@ -1,56 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: mylib/__init__.py -//// - -// @filename: mylib/a.py -//// def do_something(value: str) -> None: -//// pass - -// @filename: mylib/b.py -//// def do_other() -> None: -//// pass - -// @filename: my_common_stuffs.py -//// import mylib.b -//// BLA = '123' - -// @filename: test.py -//// import mylib.a -//// -//// from my_common_stuffs import * -//// -//// mylib.a.do_something(BLA) -//// mylib.b.do_other() - -// @filename: nestedlib/__init__.py -//// - -// @filename: nestedlib/alpha/__init__.py -//// - -// @filename: nestedlib/alpha/left.py -//// def left_func() -> None: -//// pass - -// @filename: nestedlib/alpha/right.py -//// def right_func() -> None: -//// pass - -// @filename: nested_common.py -//// import nestedlib.alpha.right - -// @filename: nested_clone_test.py -//// from nested_common import * -//// -//// nestedlib.alpha.right.right_func() - -// @filename: nested_merge_test.py -//// import nestedlib.alpha.left -//// -//// from nested_common import * -//// -//// nestedlib.alpha.left.left_func() -//// nestedlib.alpha.right.right_func() - -helper.verifyDiagnostics(); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.multipartModuleClassShadow.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.multipartModuleClassShadow.fourslash.ts deleted file mode 100644 index c4a6af9b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.multipartModuleClassShadow.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// This verifies that when a package re-exports (via wildcard) a name that is -// both an implicitly-imported submodule and a class/symbol of the same name, -// the class/symbol "wins" rather than being shadowed by the submodule. - -// @filename: pkg/__init__.py -//// from .sub import * - -// @filename: pkg/sub/__init__.py -//// from .ImageView import ImageView - -// @filename: pkg/sub/ImageView.py -//// class ImageView: -//// pass - -// @filename: test.py -//// from pkg import ImageView -//// -//// # ImageView should resolve to the class, not the submodule, so it can be -//// # used as a type annotation and called. -//// view: ImageView = ImageView() -//// reveal_type(ImageView, expected_text="type[ImageView]") - -// Companion case: a pure submodule re-export (no shadowing class) must still -// resolve as a module so that submodule member access remains available. This -// locks in that the multipart-alias behavior didn't regress. - -// @filename: pkg2/__init__.py -//// from .sub2 import * - -// @filename: pkg2/sub2/__init__.py -//// from . import mod - -// @filename: pkg2/sub2/mod.py -//// def mod_func() -> None: -//// pass - -// @filename: test2.py -//// import pkg2 -//// -//// # mod has only a submodule alias declaration, so it stays a module and its -//// # members remain accessible through the re-exported name. -//// pkg2.mod.mod_func() -//// reveal_type(pkg2.mod, expected_text='Module("..mod")') - -helper.verifyDiagnostics(); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.nameconflict.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.nameconflict.fourslash.ts deleted file mode 100644 index f41d4ebe..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.nameconflict.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: project/__init__.py -//// from .a import * - -// @filename: project/a/__init__.py -//// from .b import b - -// @filename: project/a/b.py -//// def b() -> None: -//// pass - -// @filename: project/a/test.py -//// from project import a -//// x: a.[|/*marker*/b|] - -// @ts-ignore -helper.verifyHover('markdown', { - marker: '```python\n(function) def b() -> None\n```', -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.publicSymbols.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.publicSymbols.fourslash.ts deleted file mode 100644 index c13ab975..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.publicSymbols.fourslash.ts +++ /dev/null @@ -1,65 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// [|/*import*/|][|MY_CONSTANT_VAR/*marker1*/|] -//// [|MyAliasList/*marker2*/|] -//// [|normal_variable/*marker3*/|] -//// [|MY_PROTECTED/*marker4*/|] -//// [|__MyAliasList/*marker5*/|] - -// @filename: lib.py -//// MY_CONSTANT_VAR = 42 -//// MyAliasList = list[int] -//// normal_variable = 1 -//// _MY_PROTECTED2 = False -//// __MyAliasList = int - -{ - const importRange = helper.getPositionRange('import'); - const marker1Range = helper.getPositionRange('marker1'); - const marker2Range = helper.getPositionRange('marker2'); - const marker4Range = helper.getPositionRange('marker4'); - - // @ts-ignore - await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: 'MY_CONSTANT_VAR', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import MY_CONSTANT_VAR\n```', - detail: 'Auto-import', - textEdit: { range: marker1Range, newText: 'MY_CONSTANT_VAR' }, - additionalTextEdits: [{ range: importRange, newText: 'from lib import MY_CONSTANT_VAR\n\n\n' }], - }, - ], - }, - marker2: { - completions: [ - { - label: 'MyAliasList', - kind: Consts.CompletionItemKind.Variable, - documentation: '```\nfrom lib import MyAliasList\n```', - detail: 'Auto-import', - textEdit: { range: marker2Range, newText: 'MyAliasList' }, - additionalTextEdits: [{ range: importRange, newText: 'from lib import MyAliasList\n\n\n' }], - }, - ], - }, - marker3: { completions: [] }, - marker4: { - // Protected variables SHOULD be added - completions: [ - { - label: '_MY_PROTECTED2', - kind: Consts.CompletionItemKind.Constant, - documentation: '```\nfrom lib import _MY_PROTECTED2\n```', - detail: 'Auto-import', - textEdit: { range: marker4Range, newText: '_MY_PROTECTED2' }, - additionalTextEdits: [{ range: importRange, newText: 'from lib import _MY_PROTECTED2\n\n\n' }], - }, - ], - }, - marker5: { completions: [] }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.dunderAll.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.pytyped.dunderAll.fourslash.ts deleted file mode 100644 index e45b7a56..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.dunderAll.fourslash.ts +++ /dev/null @@ -1,77 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: testpkg/py.typed -// @library: true -//// - -// @filename: testpkg/__init__.py -// @library: true -//// from . import submod -//// from .submod2 import * -//// from submod import foofoofoo5, foofoofoo6, foofoofoo7, foofoofoo8 -//// foofoofoo0: int = 0 -//// foofoofoo1: int = 1 -//// foofoofoo2: int = 2 -//// foofoofoo3: int = 3 -//// foofoofoo4: int = 4 -//// __all__ = ["foofoofoo1"] -//// __all__ += ["foofoofoo2"] -//// __all__.extend(["foofoofoo3"]) -//// __all__.extend(submod.__all__) -//// __all__.remove("foofoofoo1") -//// __all__.remove("foofoofoo6") -//// __all__.append("foofoofoo0") -//// __all__ += submod2.__all__ - -// @filename: testpkg/submod.py -// @library: true -//// foofoofoo5: int = 5 -//// foofoofoo6: int = 6 -//// foofoofoo7: int = 7 -//// foofoofoo8: int = 8 -//// __all__ = ["foofoofoo5"] -//// __all__ += ["foofoofoo6"] -//// __all__.extend(["foofoofoo7"]) - -// @filename: testpkg/submod2.py -// @library: true -//// foofoofoo9: int = 9 -//// __all__ = ["foofoofoo9"] - -// @filename: .src/test.py -//// from testpkg import * -//// foofoofoo[|/*marker1*/|] - -// Ensure that only the __all__ items appear in the list. - -// @ts-ignore -await helper.verifyCompletion('exact', 'markdown', { - marker1: { - completions: [ - { - label: 'foofoofoo0', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'foofoofoo2', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'foofoofoo3', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'foofoofoo5', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'foofoofoo7', - kind: Consts.CompletionItemKind.Variable, - }, - { - label: 'foofoofoo9', - kind: Consts.CompletionItemKind.Variable, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.privateSymbols.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.pytyped.privateSymbols.fourslash.ts deleted file mode 100644 index ea244648..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.privateSymbols.fourslash.ts +++ /dev/null @@ -1,65 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "typeCheckingMode": "basic" -//// } - -// @filename: testLib/py.typed -// @library: true -//// - -// @filename: testLib/__init__.py -// @library: true -//// from .module1 import one as one, two, three -//// four: int = two * two -//// _five: int = two + three -//// _six: int = 6 -//// __all__ = ["_six"] - -// @filename: testLib/module1.py -// @library: true -//// one: int = 1 -//// two: int = 2 -//// three: int = 3 - -// @filename: .src/test1.py -//// # viper: reportPrivateUsage=true, reportPrivateImportUsage=true -//// from testLib import one -//// from testLib import [|/*marker1*/two|] as two_alias -//// from testLib import [|/*marker2*/three|] -//// from testLib import four -//// from testLib import [|/*marker3*/_five|] -//// from testLib import _six -//// import testLib -//// testLib.one -//// testLib.[|/*marker4*/two|] -//// testLib.[|/*marker5*/three|] -//// testLib.four -//// testLib.[|/*marker6*/_five|] -//// testLib._six - -// @ts-ignore -await helper.verifyDiagnostics({ - marker1: { - category: 'error', - message: `"two" is not exported from module "testLib"\n  Import from \"testLib.module1\" instead`, - }, - marker2: { - category: 'error', - message: `"three" is not exported from module "testLib"\n  Import from \"testLib.module1\" instead`, - }, - marker3: { - category: 'error', - message: `"_five" is private and used outside of the module in which it is declared`, - }, - marker4: { category: 'error', message: `"two" is not exported from module "testLib"` }, - marker5: { - category: 'error', - message: `"three" is not exported from module "testLib"`, - }, - marker6: { - category: 'error', - message: `"_five" is private and used outside of the module in which it is declared`, - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.ts deleted file mode 100644 index 130f8038..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "typeCheckingMode": "basic" -//// } - -// @filename: testLib/py.typed -// @library: true -//// - -// @filename: testLib/__init__.py -// @library: true -//// class Foo: -//// def method1(self): -//// '''Method docs''' -//// return None -//// -//// # This method has no annotation -//// def foo(a): -//// return Foo() - -// @filename: .src/test.py -//// from testLib import foo -//// foo(1).me[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - documentation: '```python\ndef method1() -> None\n```\n---\nMethod docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.ts deleted file mode 100644 index a82e24ad..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "typeCheckingMode": "off" -//// } - -// @filename: testLib/py.typed -// @library: true -//// - -// @filename: testLib/__init__.py -// @library: true -//// class Foo: -//// def method1(self): -//// '''Method docs''' -//// return None -//// -//// # This method has no annotation -//// def foo(a): -//// return Foo() - -// @filename: .src/test.py -//// from testLib import foo -//// foo(1).me[|/*marker1*/|] - -// @ts-ignore -await helper.verifyCompletion('included', 'markdown', { - marker1: { - completions: [ - { - label: 'method1', - kind: Consts.CompletionItemKind.Method, - documentation: '```python\ndef method1() -> None\n```\n---\nMethod docs', - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.unsupportedDunderAll.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.pytyped.unsupportedDunderAll.fourslash.ts deleted file mode 100644 index 6053c2ac..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.pytyped.unsupportedDunderAll.fourslash.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "typeCheckingMode": "basic" -//// } - -// @filename: testLib/py.typed -// @library: true -//// - -// @filename: testLib/_internal.py -// @library: true -//// GraphClass: int = 1 - -// @filename: testLib/__init__.py -// @library: true -//// from ._internal import GraphClass -//// -//// # Simulate dynamic __all__ construction like dash.dcc does: -//// # __all__ = _components + ["other_symbol"] -//// # where _components comes from a wildcard import -//// _components = ["GraphClass"] -//// __all__ = _components + ["other_symbol"] - -// @filename: .src/test1.py -//// # viper: reportPrivateUsage=true, reportPrivateImportUsage=true -//// # This should NOT show an error because __all__ uses an unsupported form, -//// # so we can't determine if GraphClass is actually in __all__ or not. -//// # Since the module uses a dynamic __all__, we should be permissive. -//// from testLib import GraphClass -//// import testLib -//// testLib.GraphClass - -// @ts-ignore -await helper.verifyDiagnostics({}); diff --git a/packages/vipeye-internal/src/tests/fourslash/import.wildcard.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/import.wildcard.fourslash.ts deleted file mode 100644 index d9f49f97..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/import.wildcard.fourslash.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: testpkg/py.typed -// @library: true -//// - -// @filename: testpkg/__init__.py -// @library: true -//// __all__ = ["submod"] -//// def foo(): -//// return - -// @filename: testpkg/submod.py -// @library: true -//// def test_func(): -//// print("hi") - -// @filename: .src/test.py -//// # viper: reportWildcardImportFromLibrary=false -//// from testpkg import * -//// submod.test_func() -//// [|/*marker*/foo|]() - -// @ts-ignore -await helper.verifyDiagnostics({ - marker: { category: 'error', message: `"foo" is not defined` }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/importnotresolved.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/importnotresolved.fourslash.ts deleted file mode 100644 index 74ed9531..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/importnotresolved.fourslash.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: importnotresolved.py -//// # these will not be resolve, no typestubs for django in typeshed -//// -//// import [|/*marker1*/notexistant|] -//// import [|/*marker2*/django|] -//// - -helper.verifyDiagnostics({ - marker1: { category: 'error', message: `Import "notexistant" could not be resolved` }, - marker2: { category: 'error', message: `Import "django" could not be resolved` }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.ts deleted file mode 100644 index ec5bf78f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: typings/pkg1234/__init__.pyi -//// __version__: str - -// @filename: importnotresolved.py -//// #viper: strict -//// -//// # verify that reportMissingModuleSource can be disabled via config -//// # even when in strict mode -//// -//// import pkg1234 -//// print(pkg1234.__version__) - -// @filename: viperconfig.json -//// { -//// "reportMissingModuleSource": false -//// } - -helper.verifyDiagnostics({}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.fourslash.ts deleted file mode 100644 index c354e96f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingModuleSource.fourslash.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: typings/pkg1234/__init__.pyi -//// __version__: str - -// @filename: importnotresolved.py -//// # will not resolve, stub found but source not found -//// -//// import [|/*marker1*/pkg1234|] -//// print(pkg1234.__version__) - -helper.verifyDiagnostics({ - marker1: { - category: 'warning', - message: 'Import "pkg1234" could not be resolved from source', - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.codeAction.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.codeAction.fourslash.ts deleted file mode 100644 index dfedac40..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.codeAction.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/__init__.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// pass - -// @filename: .src/test.py -//// import [|/*marker*/testLi|]b - -// @ts-ignore -await helper.verifyCodeActions('included', { - marker: { - codeActions: [ - { - title: `Create Type Stub For "testLib"`, - kind: Consts.CodeActionKind.QuickFix, - command: { - title: 'Create Type Stub', - command: Consts.Commands.createTypeStub, - arguments: ['\\', 'testLib', '\\.src\\test.py'], - }, - }, - ], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.multipart.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.multipart.fourslash.ts deleted file mode 100644 index 8f132959..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.multipart.fourslash.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/aa/bb/__init__.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// ... - -// @filename: testLib/aa/bb/cc.py -// @library: true -//// MyAlias = int - -// @filename: test.py -//// import [|/*marker*/testLib.aa.b|]b - -const filename2 = helper.getMarkerByName('marker').fileName; -const command2 = { - title: 'Create Type Stub', - command: Consts.Commands.createTypeStub, - arguments: ['/', 'testLib.aa.bb', filename2], -}; - -// @ts-ignore -await helper.verifyCommand(command2, { - ['/typings/testLib/aa/bb/__init__.pyi']: `""" -This type stub file was generated by viper. -""" - -class MyLibrary: - def DoEveryThing(self, code: str): # -> None: - ... - - - -`, - ['/typings/testLib/aa/bb/cc.pyi']: `""" -This type stub file was generated by viper. -""" - -MyAlias = int -`, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlefile.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlefile.fourslash.ts deleted file mode 100644 index ecc436c0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlefile.fourslash.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// ... - -// @filename: test.py -//// import [|/*marker*/testLi|]b - -const filename3 = helper.getMarkerByName('marker').fileName; -const command3 = { - title: 'Create Type Stub', - command: Consts.Commands.createTypeStub, - arguments: ['/', 'testLib', filename3], -}; - -// @ts-ignore -await helper.verifyCommand(command3, { - ['/typings/testLib/__init__.pyi']: `""" -This type stub file was generated by viper. -""" - -class MyLibrary: - def DoEveryThing(self, code: str): # -> None: - ... - - - -`, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlepart.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlepart.fourslash.ts deleted file mode 100644 index 5e30cb2f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.singlepart.fourslash.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/__init__.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// ... - -// @filename: test.py -//// import [|/*marker*/testLi|]b - -const filename1 = helper.getMarkerByName('marker').fileName; -const command1 = { - title: 'Create Type Stub', - command: Consts.Commands.createTypeStub, - arguments: ['/', 'testLib', filename1], -}; - -// @ts-ignore -await helper.verifyCommand(command1, { - ['/typings/testLib/__init__.pyi']: `""" -This type stub file was generated by viper. -""" - -class MyLibrary: - def DoEveryThing(self, code: str): # -> None: - ... - - - -`, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.ts deleted file mode 100644 index 727df118..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/mylibrary.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// ... -//// class ExceptLibrary: -//// def DoEveryThing(self, code: str): -//// ... -//// class ElseLibrary: -//// def DoEveryThing(self, code: str): -//// ... - -// @filename: testLib/__init__.py -// @library: true -//// try: -//// from .mylibrary import MyLibrary -//// except: -//// from .mylibrary import ExceptLibrary -//// else: -//// from .mylibrary import ElseLibrary - -// @filename: test.py -//// import [|/*marker*/testLi|]b - -const filename4 = helper.getMarkerByName('marker').fileName; -const command4 = { - title: 'Create Type Stub', - command: Consts.Commands.createTypeStub, - arguments: ['/', 'testLib', filename4], -}; - -// @ts-ignore -await helper.verifyCommand(command4, { - ['/typings/testLib/__init__.pyi']: `""" -This type stub file was generated by viper. -""" - -from .mylibrary import MyLibrary - -`, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.fourslash.ts deleted file mode 100644 index 29fa3ff0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/__init__.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// pass - -// @filename: test.py -//// import [|/*marker*/testLib|] - -helper.verifyDiagnostics({ - marker: { category: 'warning', message: `Stub file not found for "testLib"` }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.ts deleted file mode 100644 index de22ae3b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "reportMissingTypeStubs": "warning" -//// } - -// @filename: testLib/__init__.py -// @library: true -//// # This is a library file -//// class MyLibrary: -//// def DoEveryThing(self, code: str): -//// pass - -// @filename: test.py -//// import [|/*marker*/testLi|]b - -// @ts-ignore -await helper.verifyInvokeCodeAction({ - marker: { - title: `Create Type Stub For "testLib"`, - files: { - ['/typings/testLib/__init__.pyi']: `""" -This type stub file was generated by viper. -""" - -class MyLibrary: - def DoEveryThing(self, code: str): # -> None: - ... - - - -`, - }, - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/noerrors.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/noerrors.fourslash.ts deleted file mode 100644 index bb09358c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/noerrors.fourslash.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// # make sure test works with no diagnostics -//// -//// class C: -//// pass - -helper.verifyDiagnostics(); diff --git a/packages/vipeye-internal/src/tests/fourslash/orderImports1.command.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/orderImports1.command.fourslash.ts deleted file mode 100644 index 5ac9128c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/orderImports1.command.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: quickActionOrganizeImportTest1.py -//// import time -//// import os -//// import sys - -// @ts-ignore -await helper.verifyCommand( - { - title: 'Quick action order imports 1', - command: Consts.Commands.orderImports, - arguments: ['quickActionOrganizeImportTest1.py'], - }, - { - ['quickActionOrganizeImportTest1.py']: `import os -import sys -import time`, - } -); diff --git a/packages/vipeye-internal/src/tests/fourslash/orderImports2.command.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/orderImports2.command.fourslash.ts deleted file mode 100644 index 6c089099..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/orderImports2.command.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: quickActionOrganizeImportTest2.py -//// import time -//// import sys -//// a = 100 -//// print(a) -//// import math -//// import os - -// @ts-ignore -await helper.verifyCommand( - { - title: 'Quick action order imports', - command: Consts.Commands.orderImports, - arguments: ['quickActionOrganizeImportTest2.py'], - }, - { - ['quickActionOrganizeImportTest2.py']: `import math -import os -import sys -import time`, - } -); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.fourslash.ts deleted file mode 100644 index 6e9da7ca..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test1.py -//// def [|__foo|](): -//// pass -//// -//// [|__foo/*marker*/|]() - -// @filename: test2.py -//// from test1 import [|__foo|] -//// -//// [|__foo|]() - -helper.verifyRename({ - marker: { - newName: '__foo1', - changes: helper - .getRangesByText() - .get('__foo')! - .map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: '__foo1' }; - }), - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.params.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.params.fourslash.ts deleted file mode 100644 index ee917a9b..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.externallyHidden.params.fourslash.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test1.py -//// def __foo([|param/*marker*/|]: int): -//// pass -//// -//// __foo([|param|]=1) - -// @filename: test2.py -//// from test1 import __foo -//// -//// __foo([|param|]=1) - -helper.verifyRename({ - marker: { - newName: 'param1', - changes: helper - .getRangesByText() - .get('param')! - .map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'param1' }; - }), - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.fourslash.ts deleted file mode 100644 index 351e9bee..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// class [|Test1|]: -//// def M(self, a: '[|Test1|]'): -//// pass - -// @filename: test2.py -//// from test import [|Test1|] -//// -//// b = [|[|/*marker*/Test1|]|]() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyRename({ - marker: { - newName: 'NewTest1', - changes: ranges.map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'NewTest1' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.function.untitledFile.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.function.untitledFile.fourslash.ts deleted file mode 100644 index 667f6bbd..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.function.untitledFile.fourslash.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def func(): -//// pass - -// @filename: Untitled-1.py -//// from declare import func -//// /*marker*/func() - -{ - helper.verifyRename( - { - marker: { - newName: 'func1', - changes: [], - }, - }, - true - ); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.init.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.init.fourslash.ts deleted file mode 100644 index ea157f66..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.init.fourslash.ts +++ /dev/null @@ -1,25 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> -// Verify rename doesn't use the same logic as find all references (which would find the constructor calls) - -// @filename: test.py -//// class Test1: -//// def [|/*marker*/__init__|](self): -//// pass - -// @filename: test2.py -//// from test import Test1 -//// -//// b = Test1() - -{ - const ranges = helper.getRanges().filter((r) => r.marker); - - helper.verifyRename({ - marker: { - newName: 'foo', - changes: ranges.map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'foo' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.library.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.library.fourslash.ts deleted file mode 100644 index 2abc5a70..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.library.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// def M(self, a: Test1): -//// pass - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// a = [|/*marker*/Test1|]() - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() - -helper.verifyRename({ - marker: { - newName: 'NewTest1', - changes: [], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.library.sourceAndStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.library.sourceAndStub.fourslash.ts deleted file mode 100644 index 918dc276..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.library.sourceAndStub.fourslash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: testLib1/__init__.py -// @library: true -//// class Test1: -//// def M(self, a): -//// pass - -// @filename: typings/testLib1/__init__.pyi -//// class Test1: -//// def M(self, a: Test1): ... - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// a = [|/*marker*/Test1|]() - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() - -helper.verifyRename({ - marker: { - newName: 'NewTest1', - changes: [], - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.multipleDecl.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.multipleDecl.fourslash.ts deleted file mode 100644 index 68fac2d4..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.multipleDecl.fourslash.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: foo/__init__.py -//// class Foo: -//// pass - -// @filename: test.py -//// import foo -//// [|/*marker*/foo|] = 3 -//// def [|foo|](): pass - -const ranges = helper.getRanges(); - -helper.verifyRename({ - marker: { - newName: 'foo1', - changes: ranges.map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'foo1' }; - }), - }, -}); diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.parens.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.parens.fourslash.ts deleted file mode 100644 index 04f75959..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.parens.fourslash.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// [|/*marker*/A|] = True -//// if([|A|]): -//// pass - -{ - helper.verifyRename({ - marker: { - newName: 'RenamedA', - changes: helper - .getRangesByText() - .get('A')! - .map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'RenamedA' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.sourceAndStub.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.sourceAndStub.fourslash.ts deleted file mode 100644 index 64b0beb4..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.sourceAndStub.fourslash.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: testLib1/__init__.py -//// class Test1: -//// def [|M|](self, a): -//// pass - -// @filename: testLib1/__init__.pyi -//// class Test1: -//// def [|M|](self, a: str): ... - -// @filename: test.py -//// from testLib1 import Test1 -//// -//// Test1().[|[|/*marker*/M|]|]('') - -// @filename: test2.py -//// from testLib1 import Test1 -//// -//// b = Test1() -//// func(b) -//// -//// def func(t: Test1): -//// t.[|M|]('') - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyRename({ - marker: { - newName: 'M2', - changes: ranges.map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'M2' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.string.excluded.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.string.excluded.fourslash.ts deleted file mode 100644 index e04bfb55..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.string.excluded.fourslash.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "exclude": ["**/exclude/**"] -//// } - -// @filename: exclude/test.py -//// class [|/*marker1*/A|]: -//// pass -//// -//// a = [|A|]() - -// @filename: exclude/test2.py -//// class [|/*marker2*/B|]: -//// pass -//// -//// b = [|B|]() - -{ - helper.openFile(helper.getMarkerByName('marker1').fileName); - - // excluded file opened - helper.verifyRename({ - marker1: { - newName: 'RenamedA', - changes: helper - .getRangesByText() - .get('A')! - .map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'RenamedA' }; - }), - }, - }); - - // excluded file closed - helper.verifyRename({ - marker2: { - newName: 'RenamedB', - changes: [], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.string.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.string.fourslash.ts deleted file mode 100644 index 284e5b7d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.string.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// class [|/*marker*/A|]: -//// pass -//// -//// __all__ = ["[|A|]"] - -// @filename: test2.py -//// from test import [|A|] -//// -//// a: "[|A|]" = [|A|]() - -{ - helper.verifyRename({ - marker: { - newName: 'RenamedA', - changes: helper - .getRangesByText() - .get('A')! - .map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'RenamedA' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/rename.typeParams.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/rename.typeParams.fourslash.ts deleted file mode 100644 index 37463e14..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/rename.typeParams.fourslash.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// class [|Test1|][T]: -//// def M(self, a: '[|Test1|]'): -//// pass - -// @filename: test2.py -//// from test import [|Test1|] -//// -//// b = [|[|/*marker*/Test1|]|]() - -{ - const ranges = helper.getRanges().filter((r) => !r.marker); - - helper.verifyRename({ - marker: { - newName: 'NewTest1', - changes: ranges.map((r) => { - return { filePath: r.fileName, range: helper.convertPositionRange(r), replacementText: 'NewTest1' }; - }), - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.ts deleted file mode 100644 index 2cf73f55..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def func(): -//// return 1 - -// @filename: consume.py -//// from declare import func -//// from declare import func as /*marker1*/foobar -//// -//// def callByName(): -//// func() -//// def [|callByAlias|](): -//// /*marker2*/foobar() - -// @filename: consume2.py -//// from declare import func as foobar -//// -//// def callByAlias2(): -//// func() - -{ - const ranges = helper.getRanges(); - const itemList = ranges.map((range) => { - return { filePath: range.fileName, range: helper.convertPositionRange(range), name: 'callByAlias' }; - }); - - helper.verifyShowCallHierarchyGetIncomingCalls({ - marker1: { - items: itemList, - }, - marker2: { - items: itemList, - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.ts deleted file mode 100644 index 3ce2449d..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// my_variable = "Hello, world!" - -// @filename: consume.py -//// from my_module import my_variable as /*marker*/greeting -//// -//// print(greeting) - -{ - helper.verifyShowCallHierarchyGetIncomingCalls({ - marker: { - items: [], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.ts deleted file mode 100644 index 89663e94..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def /*marker1*/func(): -//// return 1 - -// @filename: consume.py -//// from declare import func -//// from declare import /*marker2*/func as foobar -//// -//// def [|callByName|](): -//// /*marker3*/func() -//// def callByAlias(): -//// foobar() - -// @filename: consume2.py -//// from declare import func -//// -//// def [|callByName2|](): -//// func() - -{ - const ranges = helper.getRanges(); - const references = ranges.map((range) => { - return { path: range.fileName, range: helper.convertPositionRange(range) }; - }); - const itemList = [ - { filePath: references[0].path, range: references[0].range, name: 'callByName' }, - { filePath: references[1].path, range: references[1].range, name: 'callByName2' }, - ]; - - helper.verifyShowCallHierarchyGetIncomingCalls({ - marker1: { - items: itemList, - }, - marker2: { - items: itemList, - }, - marker3: { - items: itemList, - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.ts deleted file mode 100644 index e738e15f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def func(): -//// func2() -//// return func3() -//// -//// def [|func2|](): -//// print(1) -//// -//// def [|func3|](): -//// return 1 - -// @filename: consume.py -//// -//// from declare import func as /*marker1*/foobar -//// -//// def callByAlias(): -//// /*marker2*/foobar() - -// @filename: consume2.py -//// from declare import func as foobar -//// from declare import func -//// -//// def callByBoth1(): -//// func() -//// /*marker3*/foobar() -//// -//// def callByBoth2(): -//// /*marker4*/foobar() -//// func() - -{ - const ranges = helper.getRanges(); - const references = ranges.map((range) => { - return { path: range.fileName, range: helper.convertPositionRange(range) }; - }); - const itemList = [ - { filePath: references[0].path, range: references[0].range, name: 'func2' }, - { filePath: references[1].path, range: references[1].range, name: 'func3' }, - ]; - - helper.verifyShowCallHierarchyGetOutgoingCalls({ - marker1: { - items: itemList, - }, - marker2: { - items: itemList, - }, - marker3: { - items: itemList, - }, - marker4: { - items: itemList, - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.ts deleted file mode 100644 index 4b175afa..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def [|func|](): -//// func2() -//// -//// def func2(): -//// print(1) - -// @filename: consume.py -//// from declare import func as [|foobar|] -//// from declare import func -//// -//// def /*marker1*/callByAlias(): -//// foobar() -//// -//// def /*marker2*/callByName(): -//// func() -//// -//// def /*marker3*/callByBoth1(): -//// func() -//// foobar() -//// -//// def /*marker4*/callByBoth2(): -//// foobar() -//// func() -{ - const ranges = helper.getRanges(); - const references = ranges.map((range) => { - return { path: range.fileName, range: helper.convertPositionRange(range) }; - }); - - helper.verifyShowCallHierarchyGetOutgoingCalls({ - marker1: { - items: [{ filePath: references[0].path, range: references[0].range, name: 'foobar' }], - }, - marker2: { - items: [{ filePath: references[0].path, range: references[0].range, name: 'func' }], - }, - marker3: { - items: [{ filePath: references[0].path, range: references[0].range, name: 'func' }], - }, - marker4: { - items: [{ filePath: references[0].path, range: references[0].range, name: 'func' }], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.ts deleted file mode 100644 index 1282b76f..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: declare.py -//// def /*marker1*/func(): -//// func2() -//// return func3() -//// -//// def [|func2|](): -//// print(1) -//// -//// def [|func3|](): -//// return 1 - -// @filename: consume.py -//// from declare import /*marker2*/func -//// -//// def callByName(): -//// /*marker3*/func() - -{ - const ranges = helper.getRanges(); - const references = ranges.map((range) => { - return { path: range.fileName, range: helper.convertPositionRange(range) }; - }); - const itemList = [ - { filePath: references[0].path, range: references[0].range, name: 'func2' }, - { filePath: references[1].path, range: references[1].range, name: 'func3' }, - ]; - - helper.verifyShowCallHierarchyGetOutgoingCalls({ - marker1: { - items: itemList, - }, - marker2: { - items: itemList, - }, - marker3: { - items: itemList, - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.builtinDocstrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.builtinDocstrings.fourslash.ts deleted file mode 100644 index e65fafb6..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.builtinDocstrings.fourslash.ts +++ /dev/null @@ -1,45 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: docstrings.py -//// class A: ... -//// -//// class B: -//// """This is the class doc for B.""" -//// def __init__(self): -//// """This is the __init__ doc for B.""" -//// -//// class C: -//// """This is the class doc for C.""" -//// def __init__(self): -//// pass -//// -//// class D: -//// def __init__(self): -//// """This is the __init__ doc for D.""" -//// pass -//// -//// A([|/*a*/|]) -//// B([|/*b*/|]) -//// C([|/*c*/|]) -//// D([|/*d*/|]) - -{ - helper.verifySignature('plaintext', { - a: { - signatures: [{ label: '() -> A', parameters: [] }], - activeParameters: [undefined], - }, - b: { - signatures: [{ label: '() -> B', parameters: [], documentation: 'This is the __init__ doc for B.' }], - activeParameters: [undefined], - }, - c: { - signatures: [{ label: '() -> C', parameters: [], documentation: 'This is the class doc for C.' }], - activeParameters: [undefined], - }, - d: { - signatures: [{ label: '() -> D', parameters: [], documentation: 'This is the __init__ doc for D.' }], - activeParameters: [undefined], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.complicated.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.complicated.fourslash.ts deleted file mode 100644 index b62a2b3c..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.complicated.fourslash.ts +++ /dev/null @@ -1,127 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: complicated.py -//// from typing import Any, Optional, Type, Union, TypedDict, Unpack, NotRequired -//// -//// class Movie(TypedDict, extra_items=int): -//// key1: str -//// key2: NotRequired[int] -//// -//// class A: -//// def __init__(self, x: bool): ... -//// -//// def __call__(self, z: float) -> complex: ... -//// -//// def complicated(self, a: int, b: int, c: int = 1234, d: Optional[str] = None, **kwargs: Any) -> Union[int, str]: ... -//// -//// def typeddict(self, a: int, b: int, **kwargs: Unpack[Movie]) -> None: ... -//// -//// x = A(True[|/*init1*/|]) -//// -//// x.complicated([|/*c1*/|]) -//// -//// x.complicated(1, [|/*c2*/|]) -//// -//// x.complicated(1, [|/*c3/|], 3) -//// -//// x.complicated(1[|/*cA*/|],[|/*cB*/|] 2, 3, x=[|/*cX*/|]123, d="wow", z[|/*cZ*/|]=1234) -//// -//// x.typeddict(1[|/*tdA*/|], [|/*tdB*/|]2, key1=[|/*tdkey1*/|]'r', key2=[|/*tdkey2*/|]4) -//// -//// x([|/*call*/|]) -//// -//// def get_cls() -> Type[A]: -//// return A -//// -//// y = get_cls() -//// -//// y(True[|/*init2*/|]) - -{ - const xInitSignatures = [ - { - label: '(x: bool) -> A', - parameters: ['x: bool'], - }, - ]; - - const xComplicatedSignatures = [ - { - label: '(a: int, b: int, c: int = 1234, d: str | None = None, **kwargs: Any) -> (int | str)', - parameters: ['a: int', 'b: int', 'c: int = 1234', 'd: str | None = None', '**kwargs: Any'], - }, - ]; - - const xTypedDictSignatures = [ - { - label: '(a: int, b: int, *, key1: str, key2: int = ..., **kwargs: int) -> None', - parameters: ['a: int', 'b: int', '*', 'key1: str', 'key2: int = ...', '**kwargs: int'], - }, - ]; - - const xCallSignatures = [ - { - label: '(z: float) -> complex', - parameters: ['z: float'], - }, - ]; - - helper.verifySignature('plaintext', { - init1: { - signatures: xInitSignatures, - activeParameters: [0], - }, - init2: { - signatures: xInitSignatures, - activeParameters: [0], - }, - c1: { - signatures: xComplicatedSignatures, - activeParameters: [0], - }, - c2: { - signatures: xComplicatedSignatures, - activeParameters: [1], - }, - c3: { - signatures: xComplicatedSignatures, - activeParameters: [1], - }, - cA: { - signatures: xComplicatedSignatures, - activeParameters: [0], - }, - cB: { - signatures: xComplicatedSignatures, - activeParameters: [1], - }, - cX: { - signatures: xComplicatedSignatures, - activeParameters: [4], - }, - cZ: { - signatures: xComplicatedSignatures, - activeParameters: [4], - }, - call: { - signatures: xCallSignatures, - activeParameters: [0], - }, - tdA: { - signatures: xTypedDictSignatures, - activeParameters: [0], - }, - tdB: { - signatures: xTypedDictSignatures, - activeParameters: [1], - }, - tdkey1: { - signatures: xTypedDictSignatures, - activeParameters: [3], - }, - tdkey2: { - signatures: xTypedDictSignatures, - activeParameters: [4], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.cornercases.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.cornercases.fourslash.ts deleted file mode 100644 index ac1e5281..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.cornercases.fourslash.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: simple.py -//// -//// def simple(x: int, y: int) -> int: ... -//// -//// simple([|/*s1*/|] - -{ - const simpleSignatures = [ - { - label: '(x: int, y: int) -> int', - parameters: ['x: int', 'y: int'], - }, - ]; - - helper.verifySignature('plaintext', { - s1: { - signatures: simpleSignatures, - activeParameters: [0], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.dataclassAlias.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.dataclassAlias.fourslash.ts deleted file mode 100644 index abc1d7db..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.dataclassAlias.fourslash.ts +++ /dev/null @@ -1,72 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test.py -//// from typing import Any, dataclass_transform -//// -//// def model_field(*, kw_only: bool = False, alias: str = "") -> Any: -//// ... -//// -//// @dataclass_transform(field_specifiers=(model_field,)) -//// class ModelBase: -//// ... -//// -//// class DC1(ModelBase): -//// before: int = model_field() -//// env: int = model_field(alias='Invalid Identifier') -//// -//// DC1([|/*dc1*/|]) -//// -//// class DC2(ModelBase): -//// before: int = model_field(kw_only=True) -//// env: int = model_field(kw_only=True, alias='Invalid Identifier') -//// -//// DC2([|/*dc2*/|]) -//// -//// class DC3(ModelBase): -//// before: int = model_field(kw_only=True) -//// env: int = model_field(kw_only=True, alias='Invalid Identifier') -//// after: int = model_field(kw_only=True) -//// -//// DC3([|/*dc3*/|]) -//// DC3(after=[|/*dc3_with_after*/|]) - -{ - helper.verifySignature('plaintext', { - dc1: { - signatures: [ - { - label: '(before: int, Invalid Identifier: int) -> DC1', - parameters: ['before: int', 'Invalid Identifier: int'], - }, - ], - activeParameters: [0], - }, - dc2: { - signatures: [ - { - label: '(*, before: int) -> DC2', - parameters: ['*', 'before: int'], - }, - ], - activeParameters: [undefined], - }, - dc3: { - signatures: [ - { - label: '(*, before: int, after: int) -> DC3', - parameters: ['*', 'before: int', 'after: int'], - }, - ], - activeParameters: [undefined], - }, - dc3_with_after: { - signatures: [ - { - label: '(*, before: int, after: int) -> DC3', - parameters: ['*', 'before: int', 'after: int'], - }, - ], - activeParameters: [2], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.fourslash.ts deleted file mode 100644 index 7703d981..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.fourslash.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: docstrings.py -//// from typing import overload -//// -//// def repeat(a: str, b: int) -> str: -//// """Repeat the string ``a`` ``b`` times. -//// -//// >>> repeat('foo', 3) -//// 'foofoofoo' -//// """ -//// -//// return a * b -//// -//// repeat([|/*marker1*/|]) - -{ - helper.verifySignature('plaintext', { - marker1: { - signatures: [ - { - label: '(a: str, b: int) -> str', - parameters: ['a: str', 'b: int'], - documentation: "Repeat the string ``a`` ``b`` times.\n\n>>> repeat('foo', 3)\n'foofoofoo'", - }, - ], - activeParameters: [0], - }, - }); - - helper.verifySignature('markdown', { - marker1: { - signatures: [ - { - label: '(a: str, b: int) -> str', - parameters: ['a: str', 'b: int'], - documentation: "Repeat the string `a` `b` times.\n\n```\n>>> repeat('foo', 3)\n'foofoofoo'\n```", - }, - ], - activeParameters: [0], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.overloaded.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.overloaded.fourslash.ts deleted file mode 100644 index f082e399..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.overloaded.fourslash.ts +++ /dev/null @@ -1,50 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: docstrings.pyi -//// from typing import overload -//// -//// @overload -//// def repeat() -> str: -//// """This is a docstring on the first overload.""" -//// @overload -//// def repeat(x: int) -> int: ... -//// -//// repeat([|/*marker1*/|]) - -{ - helper.verifySignature('plaintext', { - marker1: { - signatures: [ - { - label: '() -> str', - parameters: [], - documentation: 'This is a docstring on the first overload.', - }, - { - label: '(x: int) -> int', - parameters: ['x: int'], - documentation: 'This is a docstring on the first overload.', - }, - ], - activeParameters: [undefined, 0], - }, - }); - - helper.verifySignature('markdown', { - marker1: { - signatures: [ - { - label: '() -> str', - parameters: [], - documentation: 'This is a docstring on the first overload.', - }, - { - label: '(x: int) -> int', - parameters: ['x: int'], - documentation: 'This is a docstring on the first overload.', - }, - ], - activeParameters: [undefined, 0], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.wildcardimports.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.wildcardimports.fourslash.ts deleted file mode 100644 index 37b62445..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.docstrings.wildcardimports.fourslash.ts +++ /dev/null @@ -1,127 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: lib1/definition.py -// @library: true -//// def func(): -//// '''func docs''' -//// pass -//// -//// class MyType: -//// def func2(self): -//// '''func2 docs''' -//// pass - -// @filename: lib1/alias.py -// @library: true -//// def func3(): -//// '''func3 docs''' -//// pass - -// @filename: lib1/withall.py -// @library: true -//// def func4(): -//// '''func4 docs''' -//// pass -//// -//// def func5(): -//// '''func5 docs''' -//// pass -//// -//// __all__ = ['func5'] - -// @filename: lib1/redirect.py -// @library: true -//// from . import withall -//// from .withall import * -//// -//// __all__ += withall.__all__ - -// @filename: lib1/wildcard.py -// @library: true -//// from .definition import * -//// from .redirect import * -//// from .alias import func3 - -// @filename: lib1/__init__.py -// @library: true -//// from .wildcard import * - -// @filename: lib1/__init__.pyi -// @library: true -//// class ufunc: -//// def __call__(self) -> None : ... -//// -//// func: ufunc -//// class MyType: -//// def func2(self) -> None : ... -//// func3: ufunc -//// func4: ufunc -//// func5: ufunc - -// @filename: test.py -//// import lib1 -//// lib1.func([|/*marker1*/|]) -//// lib1.MyType().func2([|/*marker2*/|]) -//// lib1.func3([|/*marker3*/|]) -//// lib1.func4([|/*marker4*/|]) -//// lib1.func5([|/*marker5*/|]) - -{ - helper.verifySignature('markdown', { - marker1: { - signatures: [ - { - label: '() -> None', - parameters: [], - documentation: 'func docs', - }, - ], - activeParameters: [undefined], - }, - marker2: { - signatures: [ - { - label: '() -> None', - parameters: [], - documentation: 'func2 docs', - }, - ], - activeParameters: [undefined], - }, - marker3: { - signatures: [ - { - label: '() -> None', - parameters: [], - documentation: 'func3 docs', - }, - ], - activeParameters: [undefined], - }, - marker4: { - signatures: [ - { - label: '() -> None', - parameters: [], - documentation: 'func4 docs', - }, - ], - activeParameters: [undefined], - }, - marker5: { - signatures: [ - { - label: '() -> None', - parameters: [], - documentation: 'func5 docs', - }, - ], - activeParameters: [undefined], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.dunderNew.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.dunderNew.fourslash.ts deleted file mode 100644 index 68c08ec3..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.dunderNew.fourslash.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: dunderNew.py -//// -//// class Foo: -//// def __new__(cls, x:int, y:int): -//// return super().__new__(cls) - -//// -//// Foo([|/*s1*/|] - -{ - const simpleSignatures = [ - { - label: '(x: int, y: int) -> Foo', - parameters: ['x: int', 'y: int'], - }, - ]; - - helper.verifySignature('plaintext', { - s1: { - signatures: simpleSignatures, - activeParameters: [0], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.overload.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.overload.fourslash.ts deleted file mode 100644 index 4447f2a0..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.overload.fourslash.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: overloaded.py -//// from typing import overload -//// -//// @overload -//// def foo() -> int: ... -//// -//// @overload -//// def foo(x: int) -> int: ... -//// -//// @overload -//// def foo(x: int, y: int) -> str: ... -//// -//// def foo(*args): ... -//// -//// foo(1[|/*o1*/|], 2[|/*o2*/|]) -//// -//// foo(1, 2, [|/*o3*/|]) -//// -//// foo(1, 2, someVar[|/*o4*/|] , 4, 5, 6, 7, 8) -//// -//// foo([|/*o5*/|]) - -{ - const overloadedSignatures = [ - { - label: '() -> int', - parameters: [], - }, - { - label: '(x: int) -> int', - parameters: ['x: int'], - }, - { - label: '(x: int, y: int) -> str', - parameters: ['x: int', 'y: int'], - }, - ]; - - helper.verifySignature('plaintext', { - o1: { - signatures: overloadedSignatures, - activeParameters: [undefined, 0, 0], - }, - o2: { - signatures: overloadedSignatures, - activeParameters: [undefined, undefined, 1], - }, - o3: { - signatures: overloadedSignatures, - activeParameters: [undefined, undefined, undefined], - }, - o4: { - signatures: overloadedSignatures, - activeParameters: [undefined, undefined, undefined], - }, - o5: { - signatures: overloadedSignatures, - activeParameters: [undefined, 0, 0], - callHasParameters: false, - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.posonly.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.posonly.fourslash.ts deleted file mode 100644 index 443e59b8..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.posonly.fourslash.ts +++ /dev/null @@ -1,59 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: posonly.py -//// class Test: -//// def method(self, /, a, b, *, c, d): -//// return -//// -//// def normal(self, a, /, b, *, c, d): -//// return -//// -//// Test().method([|/*m0*/|] -//// Test().method(0, [|/*m1*/|] -//// Test().method(0, 0, c=[|/*mc*/|] -//// Test().normal([|/*n0*/|] -//// Test().normal(0, [|/*n1*/|] -//// Test().normal(0, 0, c=[|/*nc*/|] - -{ - const methodSignatures = [ - { - label: '(a: Unknown, b: Unknown, *, c: Unknown, d: Unknown) -> None', - parameters: ['a: Unknown', 'b: Unknown', '*', 'c: Unknown', 'd: Unknown'], - }, - ]; - - const normalSignatures = [ - { - label: '(a: Unknown, /, b: Unknown, *, c: Unknown, d: Unknown) -> None', - parameters: ['a: Unknown', '/', 'b: Unknown', '*', 'c: Unknown', 'd: Unknown'], - }, - ]; - - helper.verifySignature('plaintext', { - m0: { - signatures: methodSignatures, - activeParameters: [0], - }, - m1: { - signatures: methodSignatures, - activeParameters: [1], - }, - mc: { - signatures: methodSignatures, - activeParameters: [3], - }, - n0: { - signatures: normalSignatures, - activeParameters: [0], - }, - n1: { - signatures: normalSignatures, - activeParameters: [2], - }, - nc: { - signatures: normalSignatures, - activeParameters: [4], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/signature.simple.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/signature.simple.fourslash.ts deleted file mode 100644 index 8c93a02a..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/signature.simple.fourslash.ts +++ /dev/null @@ -1,120 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: simple.py -//// -//// def simple(x: int, y: int) -> int: ... -//// -//// simple([|/*s1*/|])[|/*sOutside*/|] -//// -//// simple(1, [|/*s2*/|]) -//// -//// simple( [|/*s3*/|] 1 [|/*s4*/|] , [|/*s5*/|] 2 [|/*s6*/|] -//// [|/*s7*/|] ) -//// -//// x = 1234[|/*sNoCall*/|] -//// -//// 'string([|/*sNoCallInString*/|]'.capitalize() -//// -//// f'format string([|/*sNoCallInFormatString*/|]'.capitalize() -//// -//// f'format string {int.as_integer_ratio([|/*s8*/|])} '.capitalize() -//// -//// def foo(f:str): ... -//// -//// def bar(b:str): ... -//// -//// bar([|/*nestedString1*/|]foo([|/*nestedString2*/|])) -//// -//// def nested(x:int): -//// def inside(y:int): -//// return x + y -//// return inside -//// -//// nested(1)([|/*nestedString3*/|]) -{ - const simpleSignatures = [ - { - label: '(x: int, y: int) -> int', - parameters: ['x: int', 'y: int'], - }, - ]; - - helper.verifySignature('plaintext', { - s1: { - signatures: simpleSignatures, - activeParameters: [0], - }, - s2: { - signatures: simpleSignatures, - activeParameters: [1], - }, - s3: { - signatures: simpleSignatures, - activeParameters: [0], - }, - s4: { - signatures: simpleSignatures, - activeParameters: [0], - }, - s5: { - signatures: simpleSignatures, - activeParameters: [1], - }, - s6: { - signatures: simpleSignatures, - activeParameters: [1], - }, - s7: { - signatures: simpleSignatures, - activeParameters: [1], - }, - sOutside: { - noSig: true, - }, - sNoCall: { - noSig: true, - }, - sNoCallInString: { - noSig: true, - }, - sNoCallInFormatString: { - noSig: true, - }, - s8: { - signatures: [ - { - label: '(self: int) -> tuple[int, Literal[1]]', - parameters: ['self: int'], - }, - ], - activeParameters: [0], - }, - nestedString1: { - signatures: [ - { - label: '(b: str) -> None', - parameters: ['b: str'], - }, - ], - activeParameters: [0], - }, - nestedString2: { - signatures: [ - { - label: '(f: str) -> None', - parameters: ['f: str'], - }, - ], - activeParameters: [0], - }, - nestedString3: { - signatures: [ - { - label: '(y: int) -> int', - parameters: ['y: int'], - }, - ], - activeParameters: [0], - }, - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/tsconfig.json b/packages/vipeye-internal/src/tests/fourslash/tsconfig.json deleted file mode 100644 index 16731384..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "typeRoots": ["./node_modules/@types", "./typings"] - } -} \ No newline at end of file diff --git a/packages/vipeye-internal/src/tests/fourslash/typeVerifier.fourslash.ts b/packages/vipeye-internal/src/tests/fourslash/typeVerifier.fourslash.ts deleted file mode 100644 index 05a90947..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/typeVerifier.fourslash.ts +++ /dev/null @@ -1,50 +0,0 @@ -/// <reference path="typings/fourslash.d.ts" /> - -// @filename: test_pkg/py.typed -// @library: true -//// - -// @filename: test_pkg/__init__.py -// @library: true -//// -//// from .submodule1 import A as A -//// from ._submodule2 import B as B, func1 as func1 -//// - -// @filename: test_pkg/submodule1.py -// @library: true -//// -//// class A: -//// ... - -// @filename: test_pkg/_submodule2.py -// @library: true -//// -//// class B: -//// ... -//// -//// def func1(a: int = ...) -> None: -//// ... - -{ - helper.verifyTypeVerifierResults('test_pkg', /* ignoreUnknownTypesFromImports */ false, /* verboseOutput */ false, { - generalDiagnostics: [], - missingClassDocStringCount: 4, - missingDefaultParamCount: 1, - missingFunctionDocStringCount: 1, - moduleName: 'test_pkg', - packageName: 'test_pkg', - modules: new Map<string, object>([ - ['/lib/site-packages/test_pkg/__init__.py', {}], - ['/lib/site-packages/test_pkg/submodule1.py', {}], - ]), - symbols: new Map<string, object>([ - ['test_pkg.submodule1', {}], - ['test_pkg.submodule1.A', {}], - ['test_pkg.A', {}], - ['test_pkg.B', {}], - ['test_pkg._submodule2.B', {}], - ['test_pkg.func1', {}], - ]), - }); -} diff --git a/packages/vipeye-internal/src/tests/fourslash/typings/fourslash.d.ts b/packages/vipeye-internal/src/tests/fourslash/typings/fourslash.d.ts deleted file mode 100644 index 121e1a51..00000000 --- a/packages/vipeye-internal/src/tests/fourslash/typings/fourslash.d.ts +++ /dev/null @@ -1,459 +0,0 @@ -/* - * fourslash.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * - * this file only exists for the richer editing experiences on *.fourslash.ts files. - * when fourslash tests are actually running this file is not used. - * - * this basically provides type information through // <reference .. > while editing but - * get ignored when test run due to how test code is injected when running. - * see - packages\vipeye-internal\src\tests\harness\fourslash\runner.ts@runCode - for more detail - * - * when run, helper variable will be bound to TestState (packages\vipeye-internal\src\tests\harness\fourslash\testState.ts) - * so make sure Fourslash type is in sync with TestState - * - * for how markup language and helper is used in fourslash tests, see these 2 tests - * packages\vipeye-internal\src\tests\fourSlashParser.test.ts - * packages\vipeye-internal\src\tests\testState.test.ts - * - * for debugging, open *.fourslash.ts test file you want to debug, and select "fourslash current file" as debug configuration - * and set break point in one of TestState methods you are using in the test or set break point on "runCode" above - * and hit F5. - */ - -declare namespace _ { - type CompletionItemKind = - | 1 - | 2 - | 3 - | 4 - | 5 - | 6 - | 7 - | 8 - | 9 - | 10 - | 11 - | 12 - | 13 - | 14 - | 15 - | 16 - | 17 - | 18 - | 19 - | 20 - | 21 - | 22 - | 23 - | 24 - | 25; - - type FourSlashVerificationMode = 'exact' | 'included' | 'excluded'; - interface FourSlashCompletionItem { - label: string; - kind: CompletionItemKind | undefined; - insertionText?: string; - documentation?: string; - detail?: string; - textEdit?: TextEdit; - additionalTextEdits?: TextEdit[]; - detailDescription?: string; - commitCharacters?: string[]; - } - - interface FourSlashCallHierarchyItem { - filePath: string; - name: string; - range: PositionRange; - } - - interface TextRange { - start: number; - length: number; - } - - interface LineAndColumn { - // Both line and column are zero-based - line: number; - column: number; - } - - interface Marker { - fileName: string; - position: number; - data?: {}; - } - - interface Range { - fileName: string; - marker?: Marker; - pos: number; - end: number; - } - - interface TextChange { - span: TextRange; - newText: string; - } - - interface Command { - title: string; - command: string; - arguments?: any[]; - } - - interface Position { - // Both line and column are zero-based - line: number; - character: number; - } - - interface PositionRange { - start: Position; - end: Position; - } - - interface TextEdit { - range: PositionRange; - newText: string; - } - - interface DocumentRange { - path: string; - range: PositionRange; - } - - interface TextEditAction { - range: PositionRange; - replacementText: string; - } - - interface FileEditAction extends TextEditAction { - filePath: string; - } - - type DocumentHighlightKind = 1 | 2 | 3; - - interface DocumentHighlight { - range: PositionRange; - kind?: DocumentHighlightKind; - } - - interface AbbreviationInfo { - importFrom?: string; - importName: string; - } - - interface TextDocumentIdentifier { - uri: string; - } - - interface OptionalVersionedTextDocumentIdentifier extends TextDocumentIdentifier { - version: number | null; - } - - interface AnnotatedTextEdit extends TextEdit { - annotationId: string; - } - - interface TextDocumentEdit { - textDocument: OptionalVersionedTextDocumentIdentifier; - edits: (TextEdit | AnnotatedTextEdit)[]; - } - - interface FileOptions { - overwrite?: boolean; - ignoreIfExists?: boolean; - } - - interface ResourceOperation { - kind: string; - annotationId?: string; - } - - interface CreateFile extends ResourceOperation { - kind: 'create'; - uri: string; - options?: FileOptions; - } - - interface RenameFile extends ResourceOperation { - kind: 'rename'; - oldUri: string; - newUri: string; - options?: FileOptions; - } - - interface DeleteFileOptions { - recursive?: boolean; - ignoreIfNotExists?: boolean; - } - - interface DeleteFile extends ResourceOperation { - kind: 'delete'; - uri: string; - options?: DeleteFileOptions; - } - - interface ChangeAnnotation { - label: string; - needsConfirmation?: boolean; - description?: string; - } - - interface WorkspaceEdit { - changes?: { - [uri: string]: TextEdit[]; - }; - documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[]; - changeAnnotations?: { - [id: string]: ChangeAnnotation; - }; - } - - type MarkupKind = 'markdown' | 'plaintext'; - - type DefinitionFilter = 'all' | 'preferSource' | 'preferStubs'; - - interface Fourslash { - getMappedFilePath(path: string): string; - getDocumentHighlightKind(m?: Marker): DocumentHighlightKind | undefined; - - getMarkerName(m: Marker): string; - getMarkerByName(markerName: string): Marker; - getMarkerNames(): string[]; - getMarkers(): Marker[]; - - getRanges(): Range[]; - getRangesInFile(fileName: string): Range[]; - getRangesByText(): Map<string, Range[]>; - getFilteredRanges<T extends {}>( - predicate: (m: Marker | undefined, d: T | undefined, text: string) => boolean - ): Range[]; - getPositionRange(markerString: string): PositionRange; - getPosition(markerString: string): Position; - get BOF(): number; - get EOF(): number; - expandPositionRange(range: PositionRange, start: number, end: number): PositionRange; - convertPositionRange(range: Range): PositionRange; - convertPathToUri(path: string): string; - getDirectoryPath(path: string): string; - getPathSep(): string; - goToBOF(): void; - goToEOF(): void; - goToPosition(positionOrLineAndColumn: number | LineAndColumn): void; - goToMarker(nameOrMarker: string | Marker): void; - goToEachMarker(markers: readonly Marker[], action: (marker: Marker, index: number) => void): void; - goToEachRange(action: (range: Range) => void): void; - goToRangeStart({ fileName, pos }: Range): void; - - select(startMarker: string, endMarker: string): void; - selectAllInFile(fileName: string): void; - selectRange(range: Range): void; - selectLine(index: number): void; - - moveCaretRight(count: number): void; - - openFile(indexOrName: number | string): void; - openFiles(indexOrNames: (number | string)[]): void; - - verifyDiagnostics(map?: { [marker: string]: { category: string; message: string | undefined } }): void; - verifyCodeActions( - verifyMode: FourSlashVerificationMode, - map: { - [marker: string]: { - codeActions: { title: string; kind: string; command?: Command; edit?: WorkspaceEdit }[]; - }; - } - ): Promise<any>; - verifyCommand(command: Command, files: { [filePath: string]: string }): Promise<any>; - verifyInvokeCodeAction( - map: { - [marker: string]: { title: string; files?: { [filePath: string]: string }; edits?: TextEdit[] }; - }, - verifyCodeActionCount?: boolean - ): Promise<any>; - verifyHover(kind: string, map: { [marker: string]: string | null }): void; - verifyCompletion( - verifyMode: FourSlashVerificationMode, - docFormat: MarkupKind, - map: { - [marker: string]: { - completions: FourSlashCompletionItem[]; - memberAccessInfo?: { - lastKnownModule?: string; - lastKnownMemberName?: string; - unknownMemberName?: string; - }; - }; - }, - abbrMap?: { [abbr: string]: AbbreviationInfo } - ): Promise<void>; - verifySignature( - docFormat: MarkupKind, - map: { - [marker: string]: { - noSig?: boolean; - signatures?: { - label: string; - parameters: string[]; - documentation?: string; - }[]; - activeParameters?: (number | undefined)[]; - callHasParameters?: boolean; - }; - } - ): void; - verifyFindAllReferences(map: { - [marker: string]: { - references: DocumentRange[]; - }; - }): void; - verifyShowCallHierarchyGetIncomingCalls(map: { - [marker: string]: { - items: FourSlashCallHierarchyItem[]; - }; - }): void; - verifyShowCallHierarchyGetOutgoingCalls(map: { - [marker: string]: { - items: FourSlashCallHierarchyItem[]; - }; - }): void; - verifyHighlightReferences(map: { - [marker: string]: { - references: DocumentHighlight[]; - }; - }): void; - verifyFindDefinitions( - map: { - [marker: string]: { - definitions: DocumentRange[]; - }; - }, - filter?: DefinitionFilter - ): void; - verifyFindTypeDefinitions(map: { - [marker: string]: { - definitions: DocumentRange[]; - }; - }): void; - verifyRename( - map: { - [marker: string]: { - newName: string; - changes: FileEditAction[]; - }; - }, - isUntitled?: boolean - ): void; - verifyTypeVerifierResults( - packageName: string, - ignoreUnknownTypesFromImports: boolean, - verboseOutput: boolean, - expected: object - ): void; - - replace(start: number, length: number, text: string): void; - - /* not tested yet - paste(text: string): void; - type(text: string): void; - deleteChar(count: number): void; - deleteLineRange(startIndex: number, endIndexInclusive: number): void; - deleteCharBehindMarker(count: number): void; - - verifyCaretAtMarker(markerName: string): void; - verifyCurrentLineContent(text: string): void; - verifyCurrentFileContent(text: string): void; - verifyTextAtCaretIs(text: string): void; - verifyRangeIs(expectedText: string, includeWhiteSpace?: boolean): void; - - setCancelled(numberOfCalls: number): void; - resetCancelled(): void; */ - } - - export interface InlayHint { - label: string; - position?: _.Position; - kind?: Consts.InlayHintKind; - tooltip?: string; - paddingLeft?: boolean; - paddingRight?: boolean; - textEdits?: TextEdit[]; - } -} - -declare var helper: _.Fourslash; - -declare namespace Consts { - export namespace MarkupKind { - export const PlainText = 'plaintext'; - export const Markdown = 'markdown'; - } - - export namespace CodeActionKind { - export const QuickFix = 'quickfix'; - export const Refactor = 'refactor'; - } - - export enum Commands { - createTypeStub = 'viper.createtypestub', - restartServer = 'viper.restartserver', - orderImports = 'viper.organizeimports', - } - - namespace DocumentHighlightKind { - /** - * A textual occurrence. - */ - const Text: 1; - /** - * Read-access of a symbol, like reading a variable. - */ - const Read: 2; - /** - * Write-access of a symbol, like writing to a variable. - */ - const Write: 3; - } - - namespace CompletionItemKind { - const Text: 1; - const Method: 2; - const Function: 3; - const Constructor: 4; - const Field: 5; - const Variable: 6; - const Class: 7; - const Interface: 8; - const Module: 9; - const Property: 10; - const Unit: 11; - const Value: 12; - const Enum: 13; - const Keyword: 14; - const Snippet: 15; - const Color: 16; - const File: 17; - const Reference: 18; - const Folder: 19; - const EnumMember: 20; - const Constant: 21; - const Struct: 22; - const Event: 23; - const Operator: 24; - const TypeParameter: 25; - } - - namespace InlayHintKind { - const Type = 1; - const Parameter = 2; - function is(value: number): value is InlayHintKind; - } - - export type InlayHintKind = 1 | 2; - - export const IndexValueDetail = 'Index value'; -} diff --git a/packages/vipeye-internal/src/tests/hoverProvider.test.ts b/packages/vipeye-internal/src/tests/hoverProvider.test.ts deleted file mode 100644 index 4344123a..00000000 --- a/packages/vipeye-internal/src/tests/hoverProvider.test.ts +++ /dev/null @@ -1,782 +0,0 @@ -/* - * hoverProvider.test.ts - * - * hoverProvider tests. - */ - -import assert from 'assert'; -import { CancellationToken, MarkupContent } from 'vscode-languageserver'; - -import { HoverProvider } from '../languageService/hoverProvider'; -import { parseAndGetTestState, TestState } from './harness/fourslash/testState'; - -test('import tooltip - import statement', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import [|/*marker1*/matplotlib|].[|/*marker2*/pyplot|] - -// @filename: matplotlib/__init__.py -// @library: true -//// """ matplotlib """ - -// @filename: matplotlib/pyplot.py -// @library: true -//// """ pyplot """ - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(module) matplotlib\n```\n---\nmatplotlib', - marker2: '```python\n(module) pyplot\n```\n---\npyplot', - }); -}); - -test('import tooltip - import reference', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import matplotlib.pyplot -//// [|/*marker1*/matplotlib|].[|/*marker2*/pyplot|] - -// @filename: matplotlib/__init__.py -// @library: true -//// """ matplotlib """ - -// @filename: matplotlib/pyplot.py -// @library: true -//// """ pyplot """ - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(module) matplotlib\n```\n---\nmatplotlib', - marker2: '```python\n(module) pyplot\n```\n---\npyplot', - }); -}); - -test('import tooltip - import statement with stubs', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import [|/*marker1*/matplotlib|].[|/*marker2*/pyplot|] - -// @filename: matplotlib/__init__.vpi -// @library: true -//// # empty - -// @filename: matplotlib/pyplot.vpi -// @library: true -//// # empty - -// @filename: matplotlib/__init__.py -// @library: true -//// """ matplotlib """ - -// @filename: matplotlib/pyplot.py -// @library: true -//// """ pyplot """ - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(module) matplotlib\n```\n---\nmatplotlib', - marker2: '```python\n(module) pyplot\n```\n---\npyplot', - }); -}); - -test('method tooltip - docstring from implementation when stub uses non-exported name', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// from mylib import foo -//// foo.[|/*marker*/func|]() - -// @filename: mylib/__init__.py -// @library: true -//// from ._private import Foo as _Foo -//// foo = _Foo() - -// @filename: mylib/_private.py -// @library: true -//// class Foo: -//// """Some class documentation.""" -//// -//// def func(self) -> int: -//// """Some function documentation.""" -//// return 1 - -// @filename: mylib/__init__.pyi -// @library: true -//// class Foo: -//// def func(self) -> int: ... -//// -//// foo: Foo - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(method) def func() -> int\n```\n---\nSome function documentation.', - }); -}); - -test('function hover shows source default values for stub ellipsis defaults', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|](1) - -// @filename: mylib.pyi -//// def f(a: int, b: str = ...) -> None: ... - -// @filename: mylib.py -//// def f(a: int, b: int = 3) -> None: -//// ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int, b: str = 3) -> None\n```', - }); -}); - -test('function hover substitutes multiple stub ellipsis defaults from source', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|]() - -// @filename: mylib.pyi -//// def f(a: int = ..., b: str = ...) -> None: ... - -// @filename: mylib.py -//// def f(a: int = 3, b: str = "hello") -> None: -//// ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int = 3, b: str = "hello") -> None\n```', - }); -}); - -test('function hover shows concrete default values when provided by stub', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|]() - -// @filename: mylib.pyi -//// def f(a: int = 3, b: str = "hello") -> None: ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int = 3, b: str = "hello") -> None\n```', - }); -}); - -test('function hover substitutes multiple stub ellipsis defaults for selected overload', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|](1) - -// @filename: mylib.pyi -//// from typing import overload -//// -//// @overload -//// def f(a: int = ..., b: str = ...) -> None: ... -//// -//// @overload -//// def f(a: str = ..., b: str = ...) -> None: ... -//// -//// def f(*args, **kwargs) -> None: ... - -// @filename: mylib.py -//// def f(a: int = 3, b: str = "hello") -> None: -//// ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int = 3, b: str = "hello") -> None\n```', - }); -}); - -test('function hover does not substitute unsafe long defaults for stub ellipsis defaults', async () => { - const longNumber = '9'.repeat(150); - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|](1) - -// @filename: mylib.pyi -//// def f(a: int, b: str = ...) -> None: ... - -// @filename: mylib.py -//// def f(a: int, b: int = ${longNumber}) -> None: -//// ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int, b: str = ...) -> None\n```', - }); -}); - -test('function hover does not substitute unsafe multiline defaults for stub ellipsis defaults', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import mylib -//// -//// mylib.[|/*marker*/f|](1) - -// @filename: mylib.pyi -//// def f(a: int, b: str = ...) -> None: ... - -// @filename: mylib.py -//// def f(a: int, b: int = """hello -//// world""") -> None: -//// ... - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(function) def f(a: int, b: str = ...) -> None\n```', - }); -}); - -test('import tooltip - import reference - stub files', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import matplotlib.pyplot -//// [|/*marker1*/matplotlib|].[|/*marker2*/pyplot|] - -// @filename: matplotlib/__init__.pyi -// @library: true -//// # empty - -// @filename: matplotlib/pyplot.pyi -// @library: true -//// # empty - -// @filename: matplotlib/__init__.py -// @library: true -//// """ matplotlib """ - -// @filename: matplotlib/pyplot.py -// @library: true -//// """ pyplot """ - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(module) matplotlib\n```\n---\nmatplotlib', - marker2: '```python\n(module) pyplot\n```\n---\npyplot', - }); -}); - -test('import tooltip - import submodules statement', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import A.B.[|/*marker*/C|] - -// @filename: A/__init__.py -// @library: true -//// # empty - -// @filename: A/B/__init__.py -// @library: true -//// # empty - -// @filename: A/B/C/__init__.py -// @library: true -//// """ C """ - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { marker: '```python\n(module) C\n```\n---\nC' }); -}); - -test('import tooltip - import submodules reference', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// import A.B.C -//// A.B.[|/*marker*/C|] - -// @filename: A/__init__.py -// @library: true -//// # empty - -// @filename: A/B/__init__.py -// @library: true -//// # empty - -// @filename: A/B/C/__init__.py -// @library: true -//// """ C """ - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { marker: '```python\n(module) C\n```\n---\nC' }); -}); - -test('import tooltip - from import statement with stubs', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// from [|/*marker1*/matplotlib|].[|/*marker2*/pyplot|] import * - -// @filename: matplotlib/__init__.pyi -// @library: true -//// # empty - -// @filename: matplotlib/pyplot.pyi -// @library: true -//// # empty - -// @filename: matplotlib/__init__.py -// @library: true -//// """ matplotlib """ - -// @filename: matplotlib/pyplot.py -// @library: true -//// """ pyplot """ - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(module) matplotlib\n```\n---\nmatplotlib', - marker2: '```python\n(module) pyplot\n```\n---\npyplot', - }); -}); - -test('import tooltip - from import submodules statement', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// from A.B.[|/*marker*/C|] import * - -// @filename: A/__init__.py -// @library: true -//// # empty - -// @filename: A/B/__init__.py -// @library: true -//// # empty - -// @filename: A/B/C/__init__.py -// @library: true -//// """ C """ - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { marker: '```python\n(module) C\n```\n---\nC' }); -}); - -test('import tooltip - check duplicate property', async () => { - const code = ` - -// @filename: test.py -//// class Test: -//// def __init__(self) -> None: -//// self.__test = False -//// -//// @property -//// def [|/*marker*/test|](self): -//// """Test DocString. -//// -//// Returns -//// ------- -//// bool -//// Lorem Ipsum -//// """ -//// return self.__test - - `; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(property) test: (self: Self@Test) -> bool\n```\n---\nTest DocString.\n\nReturns\n-------\nbool \n    Lorem Ipsum', - }); -}); - -test('import symbol tooltip - useLibraryCodeForTypes false', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": false -//// } - -// @filename: test.py -//// from foo import [|/*marker1*/bar|] -//// from bar.baz1 import [|/*marker2*/baz2|] - -// @filename: foo/__init__.py -// @library: true -//// from .bar import bar - -// @filename: foo/bar.py -// @library: true -//// class bar: ... - -// @filename: bar/baz1/baz2/__init__.py -// @library: true -//// class baz: ... - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(import) bar: Unknown\n```', - marker2: '```python\n(module) baz2\n```', - }); -}); - -test('import symbol tooltip - useLibraryCodeForTypes true', async () => { - const code = ` -// @filename: viperconfig.json -//// { -//// "useLibraryCodeForTypes": true -//// } - -// @filename: test.py -//// from foo import [|/*marker1*/bar|] - -// @filename: foo/__init__.py -// @library: true -//// from .bar import bar - -// @filename: foo/bar.py -// @library: true -//// class bar: ... - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(class) bar\n```', - }); -}); - -test('TypedDict doc string', async () => { - const code = ` -// @filename: test.py -//// from typing import [|/*marker*/TypedDict|] - -// @filename: typing.py -// @library: true -//// def TypedDict(typename, fields=None, /, *, total=True, **kwargs): -//// """A simple typed namespace. At runtime it is equivalent to a plain dict.""" - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker'); - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker: '```python\n(class) TypedDict\n```\n---\nA simple typed namespace. At runtime it is equivalent to a plain dict.', - }); -}); - -test('hover on class Foo and its __call__ method with overloads', async () => { - const code = ` -// @filename: test.py -//// from typing import overload -//// class Foo: -//// def __init__(self): -//// pass -//// -//// @overload -//// def __call__(self, a: int) -> int: pass -//// @overload -//// def __call__(self, a: str) -> str: pass -//// def __call__(self, a: int | str) -> int | str: -//// return a -//// -//// [|/*marker1*/foo|] = Foo() -//// [|/*marker2*/foo|](1) -//// [|/*marker3*/foo|]("hello") -//// [|/*marker4*/foo|]() - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(variable) foo: Foo\n```', - marker2: '```python\n(variable) def foo(a: int) -> int\n```', - marker3: '```python\n(variable) def foo(a: str) -> str\n```', - marker4: '```python\n(variable)\ndef __call__(a: int) -> int: ...\ndef __call__(a: str) -> str: ...\n```', - }); -}); - -test('hover on __call__ method', async () => { - const code = ` -// @filename: test.py -//// class Foo: -//// def __init__(self): -//// pass -//// -//// def __call__(self, a: int) -> int: -//// return a -//// -//// [|/*marker1*/foo|] = Foo() -//// [|/*marker2*/foo|](1) - `; - - const state = parseAndGetTestState(code).state; - const marker1 = state.getMarkerByName('marker1'); - - state.openFile(marker1.fileName); - - state.verifyHover('markdown', { - marker1: '```python\n(variable) foo: Foo\n```', - marker2: '```python\n(variable) def foo(a: int) -> int\n```', - }); -}); - -test('hover return type remains stable after trivial edit for callable-returning function', () => { - const code = ` -// @filename: test.py -//// from collections.abc import Callable -//// -//// def [|/*markerA*/a|][**P, R](f: Callable[P, R]): -//// def [|/*markerB*/b|](*args: P.args, **kwargs: P.kwargs): -//// return str(f(*args, **kwargs)) -//// return b -//// -//// a -`; - - const state = parseAndGetTestState(code).state; - const markerA = state.getMarkerByName('markerA'); - - state.openFile(markerA.fileName); - - // Baseline call with file fully checked. - state.program.analyzeFile(markerA.fileUri, CancellationToken.None); - const baselineA = getHoverText(state, 'markerA'); - const baselineB = getHoverText(state, 'markerB'); - assert.strictEqual( - getHoverSignatureLine(baselineA), - '(function) def a(f: (**P@a) -> R@a) -> ((**P@a) -> str)', - `unexpected baseline hover signature for a: ${baselineA}` - ); - assert.strictEqual( - getHoverSignatureLine(baselineB), - '(function) def b(**P@a) -> str', - `unexpected baseline hover signature for b: ${baselineB}` - ); - - // Trivial edit: insert trailing whitespace after `return b`. - const file = state.testData.files.find((f) => f.fileUri.key === markerA.fileUri.key); - assert.ok(file, 'expected to find test file in state'); - const fileText = file.content; - const target = 'return b\n'; - const offset = fileText.indexOf(target); - assert.ok(offset >= 0, 'expected to find "return b" in test file'); - - state.openFile(file.fileName); - state.replace(offset + 'return b'.length, 0, ' '); - - // Regression: do not force analysis here. Hover should remain stable. - const editedA = getHoverText(state, 'markerA'); - const editedB = getHoverText(state, 'markerB'); - assert.strictEqual( - editedA, - baselineA, - `expected hover for a to remain stable after edit: baseline=${baselineA}, edited=${editedA}` - ); - assert.strictEqual(editedB, baselineB, `expected hover for b to remain stable after edit`); -}); - -test('hover on self-returning nested function does not recurse infinitely', () => { - const code = ` -// @filename: test.py -//// def [|/*marker*/outer|](): -//// def inner(): -//// return inner -//// return inner -//// -//// outer -`; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - const hover = getHoverText(state, 'marker'); - assert.strictEqual(hover, '```python\n(function) def outer() -> (() -> ...)\n```'); -}); - -test('hover on mutually-recursive nested functions does not recurse infinitely', () => { - const code = ` -// @filename: test.py -//// def [|/*marker*/outer|](): -//// def left(): -//// return right -//// def right(): -//// return left -//// return left -//// -//// outer -`; - - const state = parseAndGetTestState(code).state; - const marker = state.getMarkerByName('marker'); - state.openFile(marker.fileName); - - const hover = getHoverText(state, 'marker'); - assert.strictEqual(hover, '```python\n(function) def outer() -> (() -> (() -> ...))\n```'); -}); - -function getHoverText(state: TestState, markerName: string): string { - const marker = state.getMarkerByName(markerName); - const position = state.convertOffsetToPosition(marker.fileName, marker.position); - const hover = new HoverProvider( - state.program, - marker.fileUri, - position, - 'markdown', - CancellationToken.None - ).getHover(); - assert.ok(hover, `expected hover result for marker ${markerName}`); - assert.ok(MarkupContent.is(hover.contents), `expected MarkupContent for marker ${markerName}`); - return hover.contents.value; -} - -function getHoverSignatureLine(hover: string): string { - const lines = hover.split('\n'); - assert.ok(lines.length >= 2, `unexpected hover format: ${hover}`); - return lines[1]; -} diff --git a/packages/vipeye-internal/src/tests/localizer.test.ts b/packages/vipeye-internal/src/tests/localizer.test.ts index 0e300215..bd8fb80f 100644 --- a/packages/vipeye-internal/src/tests/localizer.test.ts +++ b/packages/vipeye-internal/src/tests/localizer.test.ts @@ -55,6 +55,10 @@ test('Override a specific string', () => { } return originalRawString!(key); } + + // 基线文案取当前 locale(本仓库默认 zh-cn),避免把英文文案写死导致与 locale 耦合。 + const expectedAbstractMessage = LocMessage.abstractMethodInvocation().format({ method: 'foo' }); + originalRawString = setGetRawString(overrideImportResolve); const value = LocMessage.importResolveFailure().format({ importName: 'foo', venv: 'python' }); @@ -62,7 +66,7 @@ test('Override a specific string', () => { try { assert.equal(value, 'Import is foo'); const nonMovedValue = LocMessage.abstractMethodInvocation().format({ method: 'foo' }); - assert.equal(nonMovedValue, 'Method "foo" cannot be called because it is abstract and unimplemented'); + assert.equal(nonMovedValue, expectedAbstractMessage); } finally { setGetRawString(originalRawString); } diff --git a/packages/vipeye-internal/src/tests/samples/project1/sample1.py b/packages/vipeye-internal/src/tests/samples/project1/sample1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project1/sample1.py rename to packages/vipeye-internal/src/tests/samples/project1/sample1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project1/subfolder1/sample2.py b/packages/vipeye-internal/src/tests/samples/project1/subfolder1/sample2.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project1/subfolder1/sample2.py rename to packages/vipeye-internal/src/tests/samples/project1/subfolder1/sample2.vp diff --git a/packages/vipeye-internal/src/tests/samples/project1/subfolder1/subfolder1-1/sample3.py b/packages/vipeye-internal/src/tests/samples/project1/subfolder1/subfolder1-1/sample3.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project1/subfolder1/subfolder1-1/sample3.py rename to packages/vipeye-internal/src/tests/samples/project1/subfolder1/subfolder1-1/sample3.vp diff --git a/packages/vipeye-internal/src/tests/samples/project4/presentfile.py b/packages/vipeye-internal/src/tests/samples/project4/presentfile.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project4/presentfile.py rename to packages/vipeye-internal/src/tests/samples/project4/presentfile.vp diff --git a/packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile2.py b/packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile2.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile2.py rename to packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile2.vp diff --git a/packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile3.py b/packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile3.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile3.py rename to packages/vipeye-internal/src/tests/samples/project4/subfolder/presentfile3.vp diff --git a/packages/vipeye-internal/src/tests/samples/project4/viperconfig.json b/packages/vipeye-internal/src/tests/samples/project4/viperconfig.json index 562e7702..0f49dc36 100644 --- a/packages/vipeye-internal/src/tests/samples/project4/viperconfig.json +++ b/packages/vipeye-internal/src/tests/samples/project4/viperconfig.json @@ -1,11 +1,11 @@ { "include": [ - "missingfile.py", - "presentfile.py", + "missingfile.vp", + "presentfile.vp", "missingdirectory", "subfolder" ], "exclude": [ - "subfolder/presentfile2.py" + "subfolder/presentfile2.vp" ] } diff --git a/packages/vipeye-internal/src/tests/samples/project_with_extended_config/sub3/stubs/sample.pyi b/packages/vipeye-internal/src/tests/samples/project_with_extended_config/sub3/stubs/sample.vpi similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_extended_config/sub3/stubs/sample.pyi rename to packages/vipeye-internal/src/tests/samples/project_with_extended_config/sub3/stubs/sample.vpi diff --git a/packages/vipeye-internal/src/tests/samples/project_with_extended_config/test.py b/packages/vipeye-internal/src/tests/samples/project_with_extended_config/test.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_extended_config/test.py rename to packages/vipeye-internal/src/tests/samples/project_with_extended_config/test.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/myvenv/Lib/site-packages/library1.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/myvenv/Lib/site-packages/library1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/myvenv/Lib/site-packages/library1.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/myvenv/Lib/site-packages/library1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/sample1.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/sample1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/sample1.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/sample1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/sample2.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/sample2.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/sample2.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/sample2.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/subfolder1-1/sample3.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/subfolder1-1/sample3.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/subfolder1-1/sample3.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_exclude/subfolder1/subfolder1-1/sample3.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/excluded/excluded1.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/excluded/excluded1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/excluded/excluded1.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/excluded/excluded1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/myvenv/Lib/site-packages/library1.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/myvenv/Lib/site-packages/library1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/myvenv/Lib/site-packages/library1.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/myvenv/Lib/site-packages/library1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/sample1.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/sample1.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/sample1.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/sample1.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/sample2.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/sample2.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/sample2.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/sample2.vp diff --git a/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/subfolder1-1/sample3.py b/packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/subfolder1-1/sample3.vp similarity index 100% rename from packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/subfolder1-1/sample3.py rename to packages/vipeye-internal/src/tests/samples/project_with_venv_auto_detect_include/subfolder1/subfolder1-1/sample3.vp diff --git a/packages/vipeye-internal/src/tests/sourceFile.test.ts b/packages/vipeye-internal/src/tests/sourceFile.test.ts index e348c08c..78797892 100644 --- a/packages/vipeye-internal/src/tests/sourceFile.test.ts +++ b/packages/vipeye-internal/src/tests/sourceFile.test.ts @@ -10,7 +10,7 @@ import * as assert from 'assert'; import { ImportResolver } from '../analyzer/importResolver'; import { SourceFile } from '../analyzer/sourceFile'; -import { ConfigOptions, getBasicDiagnosticRuleSet, getOffDiagnosticRuleSet } from '../common/configOptions'; +import { ConfigOptions, getBasicDiagnosticRuleSet } from '../common/configOptions'; import { FullAccessHost } from '../common/fullAccessHost'; import { combinePaths } from '../common/pathUtils'; import { RealTempFile, createFromRealFileSystem } from '../common/realFileSystem'; @@ -40,20 +40,21 @@ test('SourceFile setInitialDiagnosticRuleSet overrides default', () => { const fs = createFromRealFileSystem(tempFile); const serviceProvider = createServiceProvider(tempFile, fs); - // Verify basic defaults have reportPrivateImportUsage as 'error'. + // Viper 模式默认关闭 reportPrivateImportUsage(无 PEP 561 / py.typed 私有导入概念)。 const basicRuleSet = getBasicDiagnosticRuleSet(); - assert.strictEqual(basicRuleSet.reportPrivateImportUsage, 'error'); + assert.strictEqual(basicRuleSet.reportPrivateImportUsage, 'none'); - // Create a rule set with reportPrivateImportUsage set to 'none'. - const offRuleSet = getOffDiagnosticRuleSet(); - assert.strictEqual(offRuleSet.reportPrivateImportUsage, 'none'); + // 用与默认不同的 level('error')验证 setInitialDiagnosticRuleSet 确实把规则集应用到了文件上。 + const overriddenRuleSet = { ...basicRuleSet, reportPrivateImportUsage: 'error' as const }; const sourceFile = new SourceFile(serviceProvider, Uri.file(filePath, serviceProvider), () => '', false, false, { isEditMode: false, }); // Call setInitialDiagnosticRuleSet to apply config-level overrides. - sourceFile.setInitialDiagnosticRuleSet(offRuleSet); + sourceFile.setInitialDiagnosticRuleSet(overriddenRuleSet); + + assert.strictEqual((sourceFile as any)._diagnosticRuleSet.reportPrivateImportUsage, 'error'); assert.ok(sourceFile); serviceProvider.dispose(); @@ -84,7 +85,7 @@ test('No unexpected user files', () => { //// "pythonVersion": "3.14" //// } -// @filename: test.py +// @filename: test.vp //// [|/*marker*/x: int = 1|] `; diff --git a/packages/vipeye-internal/src/tests/typeEvaluator1.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator1.test.ts deleted file mode 100644 index 600d48cf..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator1.test.ts +++ /dev/null @@ -1,1211 +0,0 @@ -/* - * typeEvaluator1.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import * as assert from 'assert'; - -import * as AnalyzerNodeInfo from '../analyzer/analyzerNodeInfo'; -import { ScopeType } from '../analyzer/scope'; -import { ConfigOptions } from '../common/configOptions'; -import { - pythonVersion3_10, - pythonVersion3_11, - pythonVersion3_13, - pythonVersion3_7, - pythonVersion3_8, - pythonVersion3_9, -} from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('Unreachable1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['unreachable1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 2, 1, 6); - - configOptions.diagnosticRuleSet.reportUnreachable = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['unreachable1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 5, 0, 2, 1, 6); - - configOptions.diagnosticRuleSet.reportUnreachable = 'warning'; - const analysisResults3 = TestUtils.typeAnalyzeSampleFiles(['unreachable1.py'], configOptions); - TestUtils.validateResults(analysisResults3, 0, 5, 2, 1, 6); -}); - -test('Builtins1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['builtins1.py']); - - assert.strictEqual(analysisResults.length, 1); - assert.notStrictEqual(analysisResults[0].parseResults, undefined); - assert.strictEqual(analysisResults[0].errors.length, 0); - assert.strictEqual(analysisResults[0].warnings.length, 0); - - // This list comes from python directly. - // `python` - // `import builtins - // `dir(builtins)` - // Remove True, False, None, _, __build_class__, __debug__, __doc__ - const expectedBuiltinsSymbols = [ - 'ArithmeticError', - 'AssertionError', - 'AttributeError', - 'BaseException', - 'BaseExceptionGroup', - 'BlockingIOError', - 'BrokenPipeError', - 'BufferError', - 'BytesWarning', - 'ChildProcessError', - 'ConnectionAbortedError', - 'ConnectionError', - 'ConnectionRefusedError', - 'ConnectionResetError', - 'DeprecationWarning', - 'EOFError', - 'Ellipsis', - 'EncodingWarning', - 'EnvironmentError', - 'Exception', - 'ExceptionGroup', - 'FileExistsError', - 'FileNotFoundError', - 'FloatingPointError', - 'FutureWarning', - 'GeneratorExit', - 'IOError', - 'ImportError', - 'ImportWarning', - 'IndentationError', - 'IndexError', - 'InterruptedError', - 'IsADirectoryError', - 'KeyError', - 'KeyboardInterrupt', - 'LookupError', - 'ModuleNotFoundError', - 'MemoryError', - 'NameError', - 'NotADirectoryError', - 'NotImplemented', - 'NotImplementedError', - 'OSError', - 'OverflowError', - 'PendingDeprecationWarning', - 'PermissionError', - 'ProcessLookupError', - 'PythonFinalizationError', - 'RecursionError', - 'ReferenceError', - 'ResourceWarning', - 'RuntimeError', - 'RuntimeWarning', - 'StopAsyncIteration', - 'StopIteration', - 'SyntaxError', - 'SyntaxWarning', - 'SystemError', - 'SystemExit', - 'TabError', - 'TimeoutError', - 'TypeError', - 'UnboundLocalError', - 'UnicodeDecodeError', - 'UnicodeEncodeError', - 'UnicodeError', - 'UnicodeTranslateError', - 'UnicodeWarning', - 'UserWarning', - 'ValueError', - 'Warning', - 'WindowsError', - 'ZeroDivisionError', - '__build_class__', - '__import__', - '__loader__', - '__name__', - '__package__', - '__spec__', - 'abs', - 'aiter', - 'all', - 'anext', - 'any', - 'ascii', - 'bin', - 'bool', - 'breakpoint', - 'bytearray', - 'bytes', - 'callable', - 'chr', - 'classmethod', - 'compile', - 'complex', - 'copyright', - 'credits', - 'delattr', - 'dict', - 'dir', - 'divmod', - 'enumerate', - 'eval', - 'exec', - 'exit', - 'filter', - 'float', - 'format', - 'frozenset', - 'getattr', - 'globals', - 'hasattr', - 'hash', - 'help', - 'hex', - 'id', - 'input', - 'int', - 'isinstance', - 'issubclass', - 'iter', - 'len', - 'license', - 'list', - 'locals', - 'map', - 'max', - 'memoryview', - 'min', - 'next', - 'object', - 'oct', - 'open', - 'ord', - 'pow', - 'print', - 'property', - 'quit', - 'range', - 'repr', - 'reversed', - 'round', - 'set', - 'setattr', - 'slice', - 'sorted', - 'staticmethod', - 'str', - 'sum', - 'super', - 'tuple', - 'type', - 'vars', - 'zip', - // These really shouldn't be exposed but are defined by builtins.pyi currently. - 'function', - 'ellipsis', - ]; - - const moduleScope = AnalyzerNodeInfo.getScope(analysisResults[0].parseResults!.parserOutput.parseTree)!; - assert.notStrictEqual(moduleScope, undefined); - - const builtinsScope = moduleScope.parent!; - assert.notStrictEqual(builtinsScope, undefined); - assert.strictEqual(builtinsScope.type, ScopeType.Builtin); - - // Make sure all the expected symbols are present. - const builtinsSymbolTable = builtinsScope.symbolTable; - for (const symbolName of expectedBuiltinsSymbols) { - const symbol = moduleScope.lookUpSymbolRecursive(symbolName); - if (symbol === undefined) { - assert.fail(`${symbolName} is missing from builtins scope`); - } - } - - // Make sure the builtins scope doesn't contain symbols that - // shouldn't be present. - const symbolMap = new Map<string, string>(); - for (const symbolName of expectedBuiltinsSymbols) { - symbolMap.set(symbolName, symbolName); - } - - for (const builtinName of builtinsSymbolTable.keys()) { - const symbolInfo = moduleScope.lookUpSymbolRecursive(builtinName); - if (symbolInfo && symbolInfo.isBeyondExecutionScope) { - if (symbolMap.get(builtinName) === undefined) { - assert.fail(`${builtinName} should not be in builtins scope`); - } - } - } -}); - -test('Builtins2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['builtins2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Complex1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['complex1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypeNarrowing2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeNarrowing4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowing8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowing8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingAssert1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingAssert1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeNarrowingTypeIs1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTypeIs1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeNarrowingTypeEquals1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTypeEquals1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeNarrowingIsNone1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsNone1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsNone2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsNone2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingAny1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingAny1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsClass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsClass1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsNoneTuple1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsNoneTuple1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsNoneTuple2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsNoneTuple2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsEllipsis1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsEllipsis1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingLiteral1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingLiteral1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingLiteral2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingLiteral2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingEnum1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingEnum1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingEnum2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingEnum2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeNarrowingIsinstance1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance1.py']); - - TestUtils.validateResults(analysisResults, 9); -}); - -test('TypeNarrowingIsinstance2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeNarrowingIsinstance4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance13.py', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance19.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIsinstance21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIsinstance21.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingTupleLength1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTupleLength1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIn1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIn1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingIn2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingIn2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingLiteralMember1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingLiteralMember1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingNoneMember1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingNoneMember1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingTuple1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTuple1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingTypedDict1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTypedDict1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('TypeNarrowingTypedDict2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTypedDict2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingTypedDict3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingTypedDict3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('typeNarrowingCallable1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingCallable1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeNarrowingFalsy1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingFalsy1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeNarrowingLocalConst1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeNarrowingLocalConst1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ReturnTypes1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['returnTypes1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('ReturnTypes2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['returnTypes2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Specialization1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialization1.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Specialization2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialization2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Expression1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Expression2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Expression3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Expression4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Expression5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression5.py']); - - TestUtils.validateResults(analysisResults, 12); -}); - -test('Expression6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Expression7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Expression8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Expression9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['expression9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Unpack1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unpack1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Unpack2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unpack2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Unpack3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.7 settings. - configOptions.defaultPythonVersion = pythonVersion3_7; - const analysisResults37 = TestUtils.typeAnalyzeSampleFiles(['unpack3.py'], configOptions); - TestUtils.validateResults(analysisResults37, 1); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['unpack3.py'], configOptions); - TestUtils.validateResults(analysisResults38, 0); -}); - -test('Unpack4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['unpack4.py'], configOptions); - TestUtils.validateResults(analysisResults38, 2); - - // Analyze with Python 3.9 settings. - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults39 = TestUtils.typeAnalyzeSampleFiles(['unpack4.py'], configOptions); - TestUtils.validateResults(analysisResults39, 1); -}); - -test('Unpack4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unpack5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Lambda2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda2.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Lambda3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Lambda4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Lambda5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Lambda7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Lambda15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['lambda15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Call2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call2.py']); - - TestUtils.validateResults(analysisResults, 24); -}); - -test('Call3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.7 settings. This will generate more errors. - configOptions.defaultPythonVersion = pythonVersion3_7; - const analysisResults37 = TestUtils.typeAnalyzeSampleFiles(['call3.py'], configOptions); - TestUtils.validateResults(analysisResults37, 36); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['call3.py'], configOptions); - TestUtils.validateResults(analysisResults38, 20); -}); - -test('Call4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call5.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Call6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call6.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Call7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call7.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Call8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call9.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Call10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call10.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Call11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call12.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Call13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call14.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Call15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call15.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Call16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Call17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['call17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Function5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Function8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Function10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['function10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('KwargsUnpack1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['kwargsUnpack1.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('KwargsUnpack2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['kwargsUnpack2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('FunctionMember1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportFunctionMemberAccess = 'none'; - const analysisResult1 = TestUtils.typeAnalyzeSampleFiles(['functionMember1.py'], configOptions); - TestUtils.validateResults(analysisResult1, 0); - - configOptions.diagnosticRuleSet.reportFunctionMemberAccess = 'error'; - const analysisResult2 = TestUtils.typeAnalyzeSampleFiles(['functionMember1.py'], configOptions); - TestUtils.validateResults(analysisResult2, 3); -}); - -test('FunctionMember2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['functionMember2.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Annotations1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // This test requires 3.13 or older because 3.14 uses deferred - // type annotation evaluation. - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 21); -}); - -test('Annotations2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Annotations3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Annotations4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations4.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Annotations5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Annotations6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotations6.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('AnnotatedVar1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('AnnotatedVar2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar2.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('AnnotatedVar3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar3.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('AnnotatedVar4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar4.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('AnnotatedVar5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar5.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('AnnotatedVar6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('AnnotatedVar7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['annotatedVar7.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportTypeCommentUsage = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['annotatedVar7.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('AnnotatedVar8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotatedVar8.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Required1', () => { - // Analyze with Python 3.10 settings. - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['required1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Required2', () => { - // Analyze with Python 3.10 settings. - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['required2.py'], configOptions); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Required3', () => { - // Analyze with Python 3.10 settings. - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['required3.py'], configOptions); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Metaclass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass1.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('Metaclass2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass2.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Metaclass3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass3.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Metaclass4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass4.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Metaclass5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass5.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Metaclass6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass6.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Metaclass7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass7.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Metaclass8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass8.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Metaclass9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass9.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('Metaclass10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass10.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Metaclass11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['metaclass11.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('AssignmentExpr1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr1.py']); - TestUtils.validateResults(analysisResults, 7); -}); - -test('AssignmentExpr2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr2.py']); - TestUtils.validateResults(analysisResults, 8); -}); - -test('AssignmentExpr3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr3.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('AssignmentExpr4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr4.py']); - TestUtils.validateResults(analysisResults, 16); -}); - -test('AssignmentExpr5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr5.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('AssignmentExpr6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr6.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('AssignmentExpr7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr7.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('AssignmentExpr8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr8.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('AssignmentExpr9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignmentExpr9.py']); - TestUtils.validateResults(analysisResults, 0); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator2.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator2.test.ts deleted file mode 100644 index 40887446..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator2.test.ts +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * typeEvaluator2.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import { ConfigOptions } from '../common/configOptions'; -import { pythonVersion3_10, pythonVersion3_13, pythonVersion3_15, pythonVersion3_9 } from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('CallbackProtocol1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol1.py']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('CallbackProtocol2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallbackProtocol3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallbackProtocol4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('CallbackProtocol5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol5.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('CallbackProtocol6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol6.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('CallbackProtocol7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallbackProtocol8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallbackProtocol9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol9.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('CallbackProtocol10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallbackProtocol11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callbackProtocol11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Assignment1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment1.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Assignment2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Assignment3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Assignment4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Assignment5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Assignment6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Assignment7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Assignment8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Assignment9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment9.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Assignment10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Assignment11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assignment11.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Assignment12', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['assignment12.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportUnknownVariableType = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['assignment12.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('AugmentedAssignment1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['augmentedAssignment1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('AugmentedAssignment2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['augmentedAssignment2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('AugmentedAssignment3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['augmentedAssignment3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Super2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super7.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Super8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Super12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super12.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Super13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['super13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('MissingSuper1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['missingSuper1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportMissingSuperCall = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['missingSuper1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 4); -}); - -test('NewType1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType1.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('NewType2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType2.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('NewType3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('NewType4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType4.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('NewType5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NewType6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NewType7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newType7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('NewType8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportUnreachable = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['newTypeIsLiteral1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('isInstance1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['isinstance1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('isInstance2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['isinstance2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('isInstance3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['isinstance3.py'], configOptions); - TestUtils.validateResults(analysisResults1, 7); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['isinstance3.py'], configOptions); - TestUtils.validateResults(analysisResults2, 7); -}); - -test('isInstance4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['isinstance4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('isInstance5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['isinstance5.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('isInstance6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['isinstance6.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Unbound1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // This test requires 3.13 or older because 3.14 uses deferred - // type annotation evaluation. - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Unbound2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Unbound3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Unbound4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Unbound5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound5.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Unbound6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unbound6.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('LiteralForLoop1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportPossiblyUnboundVariable = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalForLoop1.py'], configOptions); - - // Expected errors: - // 2 errors for empty list/tuple literals (c and d are possibly unbound) - // 2 errors for non-literal iterable and string literal (e and f are possibly unbound) - // 2 errors for starred expression and list comprehension (g and h are possibly unbound) - // 1 error for all-continue loop (x is possibly unbound in this degenerate case) - // 1 error for for-else with unconditional break (z is possibly unbound — else skipped) - TestUtils.validateResults(analysisResults, 8); -}); - -test('Assert1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, this is reported as a warning. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['assert1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 2); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportAssertAlwaysTrue = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['assert1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2, 0); - - // Turn off the diagnostic. - configOptions.diagnosticRuleSet.reportAssertAlwaysTrue = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['assert1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); -}); - -test('RevealedType1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['revealedType1.py']); - - TestUtils.validateResults(analysisResults, 2, 0, 7); -}); - -test('AssertType1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['assertType1.py']); - - TestUtils.validateResults(analysisResults, 11); -}); - -test('NameBinding1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['nameBinding1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('NameBinding2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['nameBinding2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NameBinding3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['nameBinding3.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('NameBinding4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['nameBinding4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NameBinding5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['nameBinding5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('ConstrainedTypeVar2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar2.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('ConstrainedTypeVar3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ConstrainedTypeVar6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('ConstrainedTypeVar8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ConstrainedTypeVar9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar10.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ConstrainedTypeVar11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar11.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ConstrainedTypeVar12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar13.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('ConstrainedTypeVar14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar15', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.disableBytesTypePromotions = true; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar15.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstrainedTypeVar19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar19.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ConstrainedTypeVar20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constrainedTypeVar20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('MissingTypeArg1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, reportMissingTypeArgument is disabled. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['missingTypeArg1.py']); - TestUtils.validateResults(analysisResults, 1); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportMissingTypeArgument = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['missingTypeArg1.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('Solver1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver9.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver16.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver19.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver21.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver22.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver23.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Solver24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver24.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver25.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver26.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver27', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver27.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver28.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver29', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver29.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver30', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver30.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver31', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver31.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver32', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver32.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver33', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver33.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver34', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver34.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver35', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver35.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Solver36', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver36.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Solver37', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver37.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver38', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver38.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver39', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver39.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver40', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver40.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver41', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver41.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver42', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver42.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Solver43', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver43.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver44', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver44.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Solver45', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solver45.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverScoring1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverScoring1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverScoring2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverScoring2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('SolverScoring3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverScoring3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverScoring4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverScoring4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('SolverHigherOrder2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('SolverHigherOrder3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('SolverHigherOrder6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverHigherOrder14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverHigherOrder14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverLiteral1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverLiteral1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SolverLiteral2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverLiteral2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('SolverUnknown1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['solverUnknown1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Sentinel1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['sentinel1.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('Sentinel2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_15; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['sentinel2.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator3.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator3.test.ts deleted file mode 100644 index 11a0885f..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator3.test.ts +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * typeEvaluator3.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import { ConfigOptions } from '../common/configOptions'; -import { - pythonVersion3_10, - pythonVersion3_11, - pythonVersion3_12, - pythonVersion3_13, - pythonVersion3_9, -} from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('Module1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['module1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Module2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['module2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Module3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['module3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Ellipsis1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['ellipsis1.pyi']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('Generator1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator1.py']); - - TestUtils.validateResults(analysisResults, 12); -}); - -test('Generator2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Generator3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Generator4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator9.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Generator10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator11.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Generator12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator12.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Generator13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Generator15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator15.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Generator16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generator16.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Await1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['await1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Await2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['await2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Await3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['await3.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Coroutines1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // This functionality is deprecated in Python 3.11, so the type no longer - // exists in typing.pyi after that point. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['coroutines1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Coroutines2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['coroutines2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Coroutines3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // This functionality is deprecated in Python 3.11, so the type no longer - // exists in typing.pyi after that point. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['coroutines3.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Coroutines4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['coroutines4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop1.py']); - - // With the change to treat non-empty list literals as guaranteed to execute, - // func2 no longer generates an error (data is definitely list[int]). - // func3 still generates 1 error (data is potentially None in while loop). - TestUtils.validateResults(analysisResults, 1); -}); - -test('Loop2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop11.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Loop12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop12.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Loop13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop19.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop21.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop22.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop23.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop24.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop25.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop26.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop27', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop27.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop28.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop29', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop29.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop30', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop30.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop31', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop31.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Loop32', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop32.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop33', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop33.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop34', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop34.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop35', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop35.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop36', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop36.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop37', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop37.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop38', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop38.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop39', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop39.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop40', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop40.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop41', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop41.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Loop42', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop42.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop43', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop43.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop44', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop44.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop45', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop45.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop46', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop46.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop47', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop47.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop48', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop48.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop49', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop49.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop50', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop50.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop51', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop51.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Loop52', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop52.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ForLoop1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['forLoop1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('ForLoop2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['forLoop2.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Comprehension1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Comprehension2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension6.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Comprehension7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Comprehension8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comprehension10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension10.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Comprehension11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['comprehension11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Literals1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals1.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Literals2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Literals3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals3.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Literals4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Literals5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals5.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Literals6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals6.py']); - - TestUtils.validateResults(analysisResults, 25); -}); - -test('Literals7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literals7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeAlias1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeAlias4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults3_9 = TestUtils.typeAnalyzeSampleFiles(['typeAlias4.py'], configOptions); - TestUtils.validateResults(analysisResults3_9, 12); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults3_10 = TestUtils.typeAnalyzeSampleFiles(['typeAlias4.py'], configOptions); - TestUtils.validateResults(analysisResults3_10, 12); -}); - -test('TypeAlias5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias5.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeAlias6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias6.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('TypeAlias7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias9.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeAlias10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias10.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('TypeAlias11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias11.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeAlias12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias17', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['typeAlias17.py'], configOptions); - TestUtils.validateResults(analysisResults1, 4); - - configOptions.diagnosticRuleSet.reportMissingTypeArgument = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['typeAlias17.py'], configOptions); - TestUtils.validateResults(analysisResults2, 11); -}); - -test('TypeAlias18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias18.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeAlias20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias21.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAlias22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAlias22.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('RecursiveTypeAlias1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias1.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('RecursiveTypeAlias2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('RecursiveTypeAlias3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias3.py'], configOptions); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('RecursiveTypeAlias4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias5.pyi']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias10.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('RecursiveTypeAlias11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias14.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('RecursiveTypeAlias15', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias15.py'], configOptions); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('RecursiveTypeAlias16', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias16.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('RecursiveTypeAlias17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['recursiveTypeAlias17.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Classes1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Classes3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes3.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Classes4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Classes5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleVariableOverride = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes5.py'], configOptions); - TestUtils.validateResults(analysisResults, 11); - - configOptions.diagnosticRuleSet.reportIncompatibleVariableOverride = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes5.py'], configOptions); - TestUtils.validateResults(analysisResults, 35); -}); - -test('Classes6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes6.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Classes7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Classes8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Classes9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes9.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Classes10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Classes11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classes11.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Methods1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['methods1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('MethodOverride1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride1.py'], configOptions); - TestUtils.validateResults(analysisResults, 43); -}); - -test('MethodOverrideCallable1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverrideCallable1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MethodOverride2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride2.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('MethodOverride3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride3.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride3.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('MethodOverride4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride4.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('MethodOverride5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MethodOverride6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'none'; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['methodOverride6.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['methodOverride6.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('MethodOverride7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['methodOverride7.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('Enum1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Enum2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum6.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Enum7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum9', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['enum9.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['enum9.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0); -}); - -test('Enum10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Enum11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum11.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Enum12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum12.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Enum13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum13.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Enum14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enum14.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('EnumAuto1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enumAuto1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('EnumGenNextValue1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['enumGenNextValue1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator4.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator4.test.ts deleted file mode 100644 index fcfd7bf7..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator4.test.ts +++ /dev/null @@ -1,940 +0,0 @@ -/* - * typeEvaluator4.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import { ConfigOptions } from '../common/configOptions'; -import { - pythonVersion3_10, - pythonVersion3_11, - pythonVersion3_12, - pythonVersion3_13, - pythonVersion3_14, - pythonVersion3_7, - pythonVersion3_8, - pythonVersion3_9, -} from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('Final1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final1.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Final2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final2.py']); - TestUtils.validateResults(analysisResults, 15); -}); - -test('Final3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final3.py']); - TestUtils.validateResults(analysisResults, 41); -}); - -test('Final4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final4.pyi']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('Final5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final5.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Final6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final6.pyi']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Final8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['final8.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('InferredTypes1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['inferredTypes1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('InferredTypes2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['inferredTypes2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('InferredTypes3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['inferredTypes3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallSite2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callSite2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('CallSite3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callSite3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('FString1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['fstring1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 15, 1); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['fstring1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 11, 1); -}); - -test('FString2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['fstring2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('FString3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['fstring3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('FString4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['fstring4.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('FString5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.7 settings. This will generate errors. - configOptions.defaultPythonVersion = pythonVersion3_7; - const analysisResults37 = TestUtils.typeAnalyzeSampleFiles(['fstring5.py'], configOptions); - TestUtils.validateResults(analysisResults37, 6); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['fstring5.py'], configOptions); - TestUtils.validateResults(analysisResults38, 0); -}); - -test('TString1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tstring1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 11); - - configOptions.defaultPythonVersion = pythonVersion3_14; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['tstring1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 8); -}); - -test('TString2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_14; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tstring2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 1); -}); - -test('MemberAccess1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess3.py']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('MemberAccess4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess4.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('MemberAccess5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess5.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess6.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('MemberAccess7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess7.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess8.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess9.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess10.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('MemberAccess11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess11.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess12.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess13.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess14.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess15.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess16.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess17.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('MemberAccess18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess18.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess19.py']); - TestUtils.validateResults(analysisResults, 10); -}); - -test('MemberAccess20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess20.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('MemberAccess21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess21.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('MemberAccess22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess22.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess23.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess24.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess25.py']); - TestUtils.validateResults(analysisResults, 12); -}); - -test('MemberAccess26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess26.py']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('MemberAccess27', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess27.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MemberAccess28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['memberAccess28.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClassNamedTuple1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassNamedTuple1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataClassNamedTuple2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassNamedTuple2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass1.py']); - - TestUtils.validateResults(analysisResults, 11); -}); - -test('DataClass2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass3.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('DataClass4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass4.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataClass5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass12.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('DataClass13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass13.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClass16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass16.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClass17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass17.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataClass18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclass18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClassReplace1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['dataclassReplace1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 10); - - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['dataclassReplace1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 4); -}); - -test('DataClassFrozen1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassFrozen1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('DataClassKwOnly1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassKwOnly1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('DataClassKwOnly2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassKwOnly2.py'], configOptions); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('DataClassSlots1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassSlots1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('DataClassHash1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassHash1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('DataClassDescriptors1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassDescriptors1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('DataClassDescriptors2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassDescriptors2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClassConverter1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassConverter1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('DataClassConverter2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassConverter2.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('DataClassConverter3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassConverter3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataClassPostInit1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassPostInit1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('InitVar1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['initVar1.py']); - - TestUtils.validateResults(analysisResults, 2, 1); -}); - -test('Callable1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Callable2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Callable3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Callable4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Callable5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable5.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Callable6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable6.py']); - - TestUtils.validateResults(analysisResults, 9); -}); - -test('Callable7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['callable7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('FunctionAssignabilityPositionalParamMessage1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['functionAssignabilityMessage1.py']); - - TestUtils.validateResults(analysisResults, 2); - - // Addendum lines are indented with non-breaking spaces; normalize them to - // regular spaces so the full message can be asserted exactly. - - // Source accepts too few positional parameters (0) for a dest that expects 1. - // The addendum must say "too few" with expected=1 (dest), received=0 (src). - expect(analysisResults[0].errors[0].message.replace(/\u00a0/g, ' ')).toBe( - [ - 'Argument of type "() -> int" cannot be assigned to parameter "func" of type "(int) -> int" in function "decorator"', - ' Type "() -> int" is not assignable to type "(int) -> int"', - ' Function accepts too few positional parameters; expected 1 but received 0', - ].join('\n') - ); - - // Symmetric case: source accepts too many positional parameters (2) for a - // dest that accepts 1. The addendum must say "too many" with expected=1 - // (dest), received=2 (src). - expect(analysisResults[0].errors[1].message.replace(/\u00a0/g, ' ')).toBe( - [ - 'Argument of type "(a: int, b: int, /) -> int" cannot be assigned to parameter "func" of type "(int) -> int" in function "decorator"', - ' Type "(a: int, b: int, /) -> int" is not assignable to type "(int) -> int"', - ' Position-only parameter mismatch; expected 2 but received 1', - ' Function accepts too many positional parameters; expected 1 but received 2', - ].join('\n') - ); -}); - -test('Generic1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generic1.py']); - - TestUtils.validateResults(analysisResults, 9); -}); - -test('Generic2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generic2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Generic3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['generic3.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Unions1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.disableBytesTypePromotions = true; - - // Analyze with Python 3.9 settings. This will generate errors. - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults3_9 = TestUtils.typeAnalyzeSampleFiles(['unions1.py'], configOptions); - TestUtils.validateResults(analysisResults3_9, 11); - - // Analyze with Python 3.10 settings. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults3_10 = TestUtils.typeAnalyzeSampleFiles(['unions1.py'], configOptions); - TestUtils.validateResults(analysisResults3_10, 0); -}); - -test('Unions2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['unions2.py'], configOptions); - TestUtils.validateResults(analysisResults38, 0); -}); - -test('Unions3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.9 settings. This will generate errors. - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults3_9 = TestUtils.typeAnalyzeSampleFiles(['unions3.py'], configOptions); - TestUtils.validateResults(analysisResults3_9, 1); - - // Analyze with Python 3.10 settings. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults3_10 = TestUtils.typeAnalyzeSampleFiles(['unions3.py'], configOptions); - TestUtils.validateResults(analysisResults3_10, 0); -}); - -test('Unions4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unions4.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Unions5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unions5.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Unions6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unions6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ParamSpec1', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec1.py']); - TestUtils.validateResults(results, 9); -}); - -test('ParamSpec2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_9; - const analysisResults39 = TestUtils.typeAnalyzeSampleFiles(['paramSpec2.py'], configOptions); - TestUtils.validateResults(analysisResults39, 0); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults310 = TestUtils.typeAnalyzeSampleFiles(['paramSpec2.py'], configOptions); - TestUtils.validateResults(analysisResults310, 0); -}); - -test('ParamSpec3', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec3.py']); - TestUtils.validateResults(results, 3); -}); - -test('ParamSpec4', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec4.py']); - TestUtils.validateResults(results, 10); -}); - -test('ParamSpec5', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec5.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec6', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec6.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec7', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec7.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec8', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec8.py']); - TestUtils.validateResults(results, 7); -}); - -test('ParamSpec9', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec9.py']); - TestUtils.validateResults(results, 14); -}); - -test('ParamSpec10', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec10.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec11', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec11.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec12', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec12.py']); - TestUtils.validateResults(results, 14); -}); - -test('ParamSpec13', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec13.py']); - TestUtils.validateResults(results, 11); -}); - -test('ParamSpec14', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec14.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec15', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec15.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec16', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec16.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec17', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec17.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec18', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec18.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec19', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec19.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec20', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec20.py']); - TestUtils.validateResults(results, 8); -}); - -test('ParamSpec21', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec21.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec22', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec22.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec23', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec23.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec24', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec24.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec25', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec25.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec26', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec26.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec27', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec27.py']); - TestUtils.validateResults(results, 2); -}); - -test('ParamSpec28', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec28.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec29', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec29.py']); - TestUtils.validateResults(results, 3); -}); - -test('ParamSpec30', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec30.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec31', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec31.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec32', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec32.py']); - TestUtils.validateResults(results, 4); -}); - -test('ParamSpec33', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec33.py']); - TestUtils.validateResults(results, 4); -}); - -test('ParamSpec34', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec34.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec35', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec35.py']); - TestUtils.validateResults(results, 1); -}); - -test('ParamSpec36', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec36.py']); - TestUtils.validateResults(results, 3); -}); - -test('ParamSpec37', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec37.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec38', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec38.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec39', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec39.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec40', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec40.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec41', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec41.py']); - TestUtils.validateResults(results, 1); -}); - -test('ParamSpec42', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec42.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec43', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec43.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec44', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec44.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec45', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec45.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec46', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec46.py']); - TestUtils.validateResults(results, 2); -}); - -test('ParamSpec47', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec47.py']); - TestUtils.validateResults(results, 3); -}); - -test('ParamSpec48', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec48.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec49', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec49.py']); - TestUtils.validateResults(results, 8); -}); - -test('ParamSpec50', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec50.py']); - TestUtils.validateResults(results, 2); -}); - -test('ParamSpec51', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec51.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec52', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec52.py']); - TestUtils.validateResults(results, 2); -}); - -test('ParamSpec53', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec53.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec54', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec54.py']); - TestUtils.validateResults(results, 0); -}); - -test('ParamSpec55', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec55.py']); - TestUtils.validateResults(results, 1); -}); - -// Regression test for a hang reported in microsoft/pyright#11413, -// reproduced from the wrapt 2.1.x stubs. Analysis must terminate; -// the call below sets up a cyclic constraint (R := R | Awaitable[R]) -// which has no finite solution. The constraint solver detects the cycle -// and refuses to bind R, but the failure isn't surfaced as a user- -// visible error here (it occurs during bidirectional inference for an -// argument expression). The important thing is that analysis completes. -test('ParamSpec56', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['paramSpec56.py']); - TestUtils.validateResults(results, 0); -}); - -test('Slice1', () => { - const results = TestUtils.typeAnalyzeSampleFiles(['slice1.py']); - TestUtils.validateResults(results, 0); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator5.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator5.test.ts deleted file mode 100644 index 488aa8ce..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator5.test.ts +++ /dev/null @@ -1,439 +0,0 @@ -/* - * typeEvaluator5.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import { ConfigOptions } from '../common/configOptions'; -import { pythonVersion3_11, pythonVersion3_12, pythonVersion3_13 } from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('TypeParams1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams1.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypeParams2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['typeParams2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 2); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['typeParams2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0); -}); - -test('TypeParams3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams3.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypeParams4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams4.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeParams5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams5.py'], configOptions); - TestUtils.validateResults(analysisResults, 9); -}); - -test('TypeParams6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams6.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeParams7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams7.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeParams8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeParams8.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('AutoVariance1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['autoVariance1.py'], configOptions); - TestUtils.validateResults(analysisResults, 17); -}); - -test('AutoVariance2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['autoVariance2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('AutoVariance3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['autoVariance3.py'], configOptions); - TestUtils.validateResults(analysisResults, 18); -}); - -test('AutoVariance4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['autoVariance4.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('AutoVariance5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['autoVariance5.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeAliasStatement1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement1.py'], configOptions); - TestUtils.validateResults(analysisResults, 10); -}); - -test('TypeAliasStatement2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 1); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 0); -}); - -test('TypeAliasStatement3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement3.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeAliasStatement4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement4.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypeAliasStatement5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasStatement5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Hashability1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['hashability1.py']); - TestUtils.validateResults(analysisResults, 10); -}); - -test('Hashability2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['hashability2.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('Hashability3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['hashability3.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Override1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['override1.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('Override2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['override2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportImplicitOverride = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['override2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('TypeVarDefault1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefault1.py']); - TestUtils.validateResults(analysisResults, 14); -}); - -test('TypeVarDefault2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefault2.py'], configOptions); - TestUtils.validateResults(analysisResults, 24); -}); - -test('TypeVarDefault3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefault3.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypeVarDefault4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefault4.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeVarDefault5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefault5.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarDefaultClass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultClass1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarDefaultClass2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultClass2.py'], configOptions); - TestUtils.validateResults(analysisResults, 10); -}); - -test('TypeVarDefaultClass3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultClass3.py'], configOptions); - TestUtils.validateResults(analysisResults, 9); -}); - -test('TypeVarDefaultClass4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultClass4.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarDefaultTypeAlias1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultTypeAlias1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarDefaultTypeAlias2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultTypeAlias2.py']); - TestUtils.validateResults(analysisResults, 11); -}); - -test('TypeVarDefaultTypeAlias3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultTypeAlias3.py'], configOptions); - TestUtils.validateResults(analysisResults, 10); -}); - -test('TypeVarDefaultFunction1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultFunction1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarDefaultFunction2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultFunction2.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeVarDefaultFunction3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_13; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarDefaultFunction3.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('FutureImport1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['futureImport1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('FutureImport2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['futureImport2.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('FutureImport3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['futureImport3.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Conditional1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['conditional1.py']); - TestUtils.validateResults(analysisResults, 15); -}); - -test('TypePrinter1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typePrinter1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypePrinter3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typePrinter3.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeAliasType1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasType1.py'], configOptions); - TestUtils.validateResults(analysisResults, 17); -}); - -test('TypeAliasType2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasType2.py']); - TestUtils.validateResults(analysisResults, 7); -}); - -test('TypedDictReadOnly1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictReadOnly1.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDictReadOnly2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictReadOnly2.py']); - TestUtils.validateResults(analysisResults, 17); -}); - -test('TypedDictClosed1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed1.py']); - TestUtils.validateResults(analysisResults, 7); -}); - -test('TypedDictClosed2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed2.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDictClosed3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed3.py']); - TestUtils.validateResults(analysisResults, 13); -}); - -test('TypedDictClosed4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed4.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('TypedDictClosed5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed5.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDictClosed6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed6.py']); - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypedDictClosed7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed7.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypedDictClosed8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed8.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDictClosed9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed9.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDictClosed10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictClosed10.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('DataclassTransform1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassTransform1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataclassTransform2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassTransform2.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataclassTransform3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassTransform3.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('DataclassTransform4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dataclassTransform4.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Async1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['async1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypeCheckOnly1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeCheckOnly1.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('NoTypeCheck1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['noTypeCheck1.py']); - TestUtils.validateResults(analysisResults, 2); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator6.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator6.test.ts deleted file mode 100644 index 9e2c06ca..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator6.test.ts +++ /dev/null @@ -1,1057 +0,0 @@ -/* - * typeEvaluator6.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import * as assert from 'assert'; - -import { ConfigOptions } from '../common/configOptions'; -import { pythonVersion3_10, pythonVersion3_11, pythonVersion3_12, pythonVersion3_8 } from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('Overload1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overload1.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Overload2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overload2.py']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('Overload3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overload3.py']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('Overload4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overload4.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Overload5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overload5.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('OverloadCall1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('OverloadCall2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('OverloadCall3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('OverloadCall4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall4.py']); - TestUtils.validateResults(analysisResults, 4); -}); - -test('OverloadCall5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall5.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('OverloadCall6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall6.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('OverloadCall7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall7.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('OverloadCall8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall8.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('OverloadCall9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall9.py']); - TestUtils.validateResults(analysisResults, 8); -}); - -test('OverloadCall10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadCall10.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('OverloadOverride1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadOverride1.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('OverloadImpl1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadImpl1.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('OverloadImpl2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadImpl2.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('OverloadImpl3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadImpl3.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('OverloadOverlap1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportOverlappingOverload = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadOverlap1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - configOptions.diagnosticRuleSet.reportOverlappingOverload = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadOverlap1.py'], configOptions); - TestUtils.validateResults(analysisResults, 16); -}); - -test('TypeGuard1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeGuard1.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypeGuard2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeGuard2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeGuard3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeGuard3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeIs1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIs1.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeIs2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIs2.py']); - TestUtils.validateResults(analysisResults, 9); -}); - -test('TypeIs3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIs3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeIs4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeIs4.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Never1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['never1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Never2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['never2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypePromotions1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.disableBytesTypePromotions = false; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typePromotions1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Index1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['index1.py']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('ProtocolModule2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocolModule2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('ProtocolModule4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocolModule4.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeVarTuple1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple1.py'], configOptions); - TestUtils.validateResults(analysisResults, 18); -}); - -test('TypeVarTuple2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple2.py'], configOptions); - TestUtils.validateResults(analysisResults, 16); -}); - -test('TypeVarTuple3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple3.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypeVarTuple4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple4.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeVarTuple5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple5.py'], configOptions); - TestUtils.validateResults(analysisResults, 9); -}); - -test('TypeVarTuple6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple6.py'], configOptions); - TestUtils.validateResults(analysisResults, 10); -}); - -test('TypeVarTuple7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple7.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('TypeVarTuple8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple8.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeVarTuple9', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple9.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple10', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple10.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeVarTuple11', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple11.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeVarTuple12', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple12.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple13', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple13.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeVarTuple14', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple14.py'], configOptions); - TestUtils.validateResults(analysisResults, 14); -}); - -test('TypeVarTuple15', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple15.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple16', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple16.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple17', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple17.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple18', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple18.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeVarTuple19', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple19.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple20', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple20.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple21', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple21.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple22', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple22.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeVarTuple23', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple23.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple24', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple24.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple25', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple25.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple26', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple26.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeVarTuple27', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple27.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeVarTuple28', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple28.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple29', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple29.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple30', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple30.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVarTuple31', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVarTuple31.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0, 1); - - // The constructor call's inferred type should be fully concrete. In - // particular, the solved "OO" TypeVar from "unpack_then" must not escape - // into the result. Rather than pinning the full (brittle) nested-tuple - // expansion, assert the concrete outer shape and the absence of the leaked - // TypeVar so the fix stays self-evident without coupling to the exact - // type-printer output. - const revealedType = analysisResults[0].infos[0].message; - assert.ok( - revealedType.startsWith('Type of "inferred" is "ForwardRefParser['), - `Unexpected inferred type: ${revealedType}` - ); - assert.ok(!/\bOO\b/.test(revealedType), `"OO" TypeVar escaped into inferred type: ${revealedType}`); -}); - -test('Match1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['match1.py'], configOptions); - TestUtils.validateResults(analysisResults, 21); -}); - -test('Match2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['match2.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Match3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['match3.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchSequence1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchSequence1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('MatchSequence2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchSequence2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchSequenceVariadic', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchSequenceVariadic.py'], configOptions); - // After fix: should be 4 errors and 0 unreachable code - TestUtils.validateResults(analysisResults, 4, 0, undefined, undefined, 0); -}); - -test('MatchClass1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass1.py'], configOptions); - TestUtils.validateResults(analysisResults, 7); -}); - -test('MatchClass2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchClass3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass3.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchClass4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass4.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchClass5', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass5.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('MatchClass6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass6.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchClass7', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass7.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('MatchClass8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchClass8.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('MatchValue1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchValue1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchMapping1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchMapping1.py'], configOptions); - TestUtils.validateResults(analysisResults, 2); -}); - -test('MatchLiteral1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchLiteral1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchLiteral2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchLiteral2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); -}); - -test('MatchExhaustion1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - configOptions.diagnosticRuleSet.reportMatchNotExhaustive = 'none'; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['matchExhaustion1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportMatchNotExhaustive = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['matchExhaustion1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 4); -}); - -test('MatchUnnecessary1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['matchUnnecessary1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportUnnecessaryComparison = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['matchUnnecessary1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 7); -}); - -test('List1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['list1.py']); - TestUtils.validateResults(analysisResults, 3); -}); - -test('List2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['list2.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('List3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['list3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Comparison1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['comparison1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportUnnecessaryComparison = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['comparison1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 7); -}); - -test('Comparison2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['comparison2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportUnnecessaryComparison = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['comparison2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 18); -}); - -test('EmptyContainers1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['emptyContainers1.py']); - TestUtils.validateResults(analysisResults, 5); -}); - -test('InitSubclass1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['initsubclass1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('InitSubclass2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['initsubclass2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('InitSubclass3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['initsubclass3.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('None1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['none1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('None2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['none2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Constructor1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor4.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor6.py']); - - TestUtils.validateResults(analysisResults, 0, 1); -}); - -test('Constructor7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor13.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor16.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Constructor17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor19.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor20.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Constructor21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor21.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Constructor22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor22.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor23.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor24', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.strictParameterNoneValue = false; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor24.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); - - configOptions.diagnosticRuleSet.strictParameterNoneValue = true; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor24.py'], configOptions); - TestUtils.validateResults(analysisResults, 5); -}); - -test('Constructor25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor25.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor26.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Constructor27', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor27.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor28.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor29', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor29.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor30', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor30.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor31', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor31.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Constructor32', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor32.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Constructor33', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructor33.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ConstructorCallable1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructorCallable1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('ConstructorCallable2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['constructorCallable2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('InconsistentConstructor1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportInconsistentConstructor = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['inconsistentConstructor1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportInconsistentConstructor = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['inconsistentConstructor1.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('ClassGetItem1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classGetItem1.py']); - - TestUtils.validateResults(analysisResults, 0, 1); -}); - -test('UnusedCallResult1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, this is disabled. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedCallResult1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Enable it as an error. - configOptions.diagnosticRuleSet.reportUnusedCallResult = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedCallResult1.py'], configOptions); - TestUtils.validateResults(analysisResults, 4); -}); - -test('UnusedCoroutine1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['unusedCoroutine1.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('FunctionAnnotation1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['functionAnnotation1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('FunctionAnnotation2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['functionAnnotation2.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('FunctionAnnotation3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['functionAnnotation3.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('FunctionAnnotation4', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['functionAnnotation4.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportTypeCommentUsage = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['functionAnnotation4.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('Subscript1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['subscript1.py'], configOptions); - TestUtils.validateResults(analysisResults38, 14); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults39 = TestUtils.typeAnalyzeSampleFiles(['subscript1.py'], configOptions); - TestUtils.validateResults(analysisResults39, 0); -}); - -test('Subscript2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['subscript2.py']); - TestUtils.validateResults(analysisResults, 8); -}); - -test('Subscript3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['subscript3.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Subscript4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['subscript4.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['decorator3.py'], configOptions); - TestUtils.validateResults(analysisResults38, 3); - - // Analyze with Python 3.8 settings. - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults39 = TestUtils.typeAnalyzeSampleFiles(['decorator3.py'], configOptions); - TestUtils.validateResults(analysisResults39, 0); -}); - -test('Decorator4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Decorator7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['decorator7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator7.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator7.test.ts deleted file mode 100644 index d4be9199..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator7.test.ts +++ /dev/null @@ -1,1054 +0,0 @@ -/* - * typeEvaluator7.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import { ConfigOptions } from '../common/configOptions'; -import { - pythonVersion3_10, - pythonVersion3_11, - pythonVersion3_12, - pythonVersion3_13, - pythonVersion3_14, - pythonVersion3_8, -} from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('GenericType1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('GenericType2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType3.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('GenericType4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType4.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('GenericType8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType9.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('GenericType10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType18.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType19.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType20.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType21.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType22.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType23.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType24.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType25.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType26.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('GenericType27', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType27.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType28.py']); - - TestUtils.validateResults(analysisResults, 18); -}); - -test('GenericType29', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType29.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType30', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType30.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType31', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType31.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('GenericType32', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType32.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType33', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType33.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType34', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType34.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType35', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType35.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('GenericType36', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType36.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType37', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType37.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType38', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType38.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType39', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType39.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType40', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType40.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType41', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType41.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType42', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType42.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType43', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType43.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType44', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType44.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType45', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType45.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('GenericType46', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType46.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('GenericType47', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['genericType47.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol1.py']); - - TestUtils.validateResults(analysisResults, 9); -}); - -test('Protocol2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol3.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('Protocol4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol4.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Protocol5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol6.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Protocol7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol12.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol16.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol17', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportInvalidTypeVarUse = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol17.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('Protocol18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol18.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol19.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol21.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol22', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportInvalidTypeVarUse = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol22.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol23.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol24.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Protocol25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol25.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol26', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol26.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol28', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol28.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol29', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol29.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol30', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol30.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol31', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol31.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol32', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol32.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol33', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol33.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol34', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol34.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol35', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol35.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Protocol36', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol36.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol37', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol37.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol38', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol38.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol39', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol39.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol40', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol40.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol41', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol41.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol42', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol42.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol43', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol43.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol44', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol44.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol45', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol45.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol46', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol46.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol47', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol47.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Protocol48', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol48.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol49', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol49.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol50', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol50.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol51', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol51.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol52', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocol52.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Protocol53', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Note: This test exposes some inconsistencies between override checks - // and protocol matching. Both of these should generate 8 errors. - configOptions.diagnosticRuleSet.reportAssignmentType = 'none'; - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['protocol53.py'], configOptions); - TestUtils.validateResults(analysisResults1, 10); - - configOptions.diagnosticRuleSet.reportAssignmentType = 'error'; - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'none'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['protocol53.py'], configOptions); - TestUtils.validateResults(analysisResults2, 8); -}); - -test('ProtocolExplicit1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocolExplicit1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('ProtocolExplicit3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['protocolExplicit3.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypedDict1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict1.py']); - - TestUtils.validateResults(analysisResults, 11); -}); - -test('TypedDict2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict2.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDict3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDict4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict4.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('TypedDict5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict5.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDict6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict6.py']); - - TestUtils.validateResults(analysisResults, 15); -}); - -test('TypedDict7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDict8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict8.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypedDict9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict9.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDict10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict10.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypedDict11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDict12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict12.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypedDict13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict13.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypedDict14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict14.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDict15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict15.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypedDict16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict16.py']); - - TestUtils.validateResults(analysisResults, 7); -}); - -test('TypedDict17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict17.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypedDict18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict18.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypedDict19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict19.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypedDict20', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict20.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDict21', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict21.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDict22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict22.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDict23', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict23.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypedDict24', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict24.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypedDict25', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDict25.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypedDictInline1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.enableExperimentalFeatures = true; - - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typedDictInline1.py'], configOptions); - TestUtils.validateResults(analysisResults, 6); -}); - -test('ClassVar1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar1.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ClassVar2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('ClassVar3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar3.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('ClassVar4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ClassVar5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ClassVar6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar6.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('ClassVar7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['classVar7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('TypeVar1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('TypeVar2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVar3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar3.py']); - - TestUtils.validateResults(analysisResults, 12); -}); - -test('TypeVar4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar4.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeVar5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar5.py']); - - TestUtils.validateResults(analysisResults, 18); -}); - -test('TypeVar6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar6.py']); - - TestUtils.validateResults(analysisResults, 20); -}); - -test('TypeVar7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar7.py']); - - TestUtils.validateResults(analysisResults, 26); -}); - -test('TypeVar8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['typeVar8.py'], configOptions); - TestUtils.validateResults(analysisResults1, 4); - - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['typeVar8.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('TypeVar9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar9.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('TypeVar10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeVar11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeVar11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Annotated1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_8; - const analysisResults38 = TestUtils.typeAnalyzeSampleFiles(['annotated1.py'], configOptions); - TestUtils.validateResults(analysisResults38, 5); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults39 = TestUtils.typeAnalyzeSampleFiles(['annotated1.py'], configOptions); - TestUtils.validateResults(analysisResults39, 3); -}); - -test('Annotated2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['annotated2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Circular1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // This test requires 3.13 or older because 3.14 uses deferred - // type annotation evaluation. - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['circular1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Circular2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['circular2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TryExcept1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TryExcept2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TryExcept3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TryExcept4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept4.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TryExcept5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TryExcept6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept6.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TryExcept8', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept8.py'], configOptions); - TestUtils.validateResults(analysisResults, 3); -}); - -test('TryExcept9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept9.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TryExcept10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept10.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('TryExcept11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tryExcept11.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('TryExcept12', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_13; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tryExcept12.py'], configOptions); - TestUtils.validateResults(analysisResults1, 3); - - configOptions.defaultPythonVersion = pythonVersion3_14; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['tryExcept12.py'], configOptions); - TestUtils.validateResults(analysisResults2, 1); -}); - -test('exceptionGroup1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['exceptionGroup1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 34); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['exceptionGroup1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 10); -}); - -test('Del1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['del1.py']); - TestUtils.validateResults(analysisResults, 6); -}); - -test('Del2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['del2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Any1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['any1.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('Type1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['type1.py']); - - TestUtils.validateResults(analysisResults, 8); -}); diff --git a/packages/vipeye-internal/src/tests/typeEvaluator8.test.ts b/packages/vipeye-internal/src/tests/typeEvaluator8.test.ts deleted file mode 100644 index c84faadc..00000000 --- a/packages/vipeye-internal/src/tests/typeEvaluator8.test.ts +++ /dev/null @@ -1,1106 +0,0 @@ -/* - * typeEvaluator8.test.ts - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT license. - * Author: Eric Traut - * - * Unit tests for viper type evaluator. Tests are split - * arbitrarily among multiple files so they can run in parallel. - */ - -import * as assert from 'assert'; - -import { ConfigOptions } from '../common/configOptions'; -import { pythonVersion3_10, pythonVersion3_11, pythonVersion3_8, pythonVersion3_12 } from '../common/pythonVersion'; -import { Uri } from '../common/uri/uri'; -import * as TestUtils from './testUtils'; - -test('Import1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import1.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Import2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import2.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Import4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import4.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Import6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import6.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Import7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import7.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('Import9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import9.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Import10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import10.py']); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Import11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import11.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Import12', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, optional diagnostics are ignored. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 2); - - // Turn on error. - configOptions.diagnosticRuleSet.reportWildcardImportFromLibrary = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions); - TestUtils.validateResults(analysisResults, 2, 0); - - // Turn off diagnostic. - configOptions.diagnosticRuleSet.reportWildcardImportFromLibrary = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['import12.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); -}); - -test('Import14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import14.py', 'import13.py']); - - assert.strictEqual(analysisResults.length, 2); - assert.strictEqual(analysisResults[0].errors.length, 0); - assert.strictEqual(analysisResults[1].errors.length, 0); -}); - -test('Import15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import15.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Import16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import16.py']); - TestUtils.validateResults(analysisResults, 0); -}); - -test('Import18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['import18.py']); - TestUtils.validateResults(analysisResults, 2); -}); - -test('DunderAll1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, reportUnsupportedDunderAll is a warning. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 7); - - // Turn on error. - configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions); - TestUtils.validateResults(analysisResults, 7, 0); - - // Turn off diagnostic. - configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); -}); - -test('DunderAll2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // By default, reportUnsupportedDunderAll is a warning. - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 3); - - // Turn on error. - configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions); - TestUtils.validateResults(analysisResults, 3, 0); - - // Turn off diagnostic. - configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'none'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); -}); - -test('DunderAll3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Turn on error. - configOptions.diagnosticRuleSet.reportUnsupportedDunderAll = 'error'; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dunderAll3.pyi'], configOptions); - TestUtils.validateResults(analysisResults, 0, 0); -}); - -test('CodeFlow1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('CodeFlow2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('CodeFlow3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow7.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('CodeFlow10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow10.py']); - - TestUtils.validateResults(analysisResults, 0, 0, 2); /* 2 reveal_type infos */ -}); - -test('CodeFlow11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['codeFlow11.py']); - - TestUtils.validateResults(analysisResults, 4, 0, 4); -}); - -test('CapturedVariable1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['capturedVariable1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('CapturedVariable2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['capturedVariable2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Property1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Property2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property2.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Property3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property3.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Property4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property6', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Analyze with reportPropertyTypeMismatch enabled. - configOptions.diagnosticRuleSet.reportPropertyTypeMismatch = 'error'; - const analysisResult1 = TestUtils.typeAnalyzeSampleFiles(['property6.py'], configOptions); - TestUtils.validateResults(analysisResult1, 2); - - // Analyze with reportPropertyTypeMismatch disabled. - configOptions.diagnosticRuleSet.reportPropertyTypeMismatch = 'none'; - const analysisResult2 = TestUtils.typeAnalyzeSampleFiles(['property6.py'], configOptions); - TestUtils.validateResults(analysisResult2, 0); -}); - -test('Property7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Property8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property8.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('Property9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property11.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Property12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property14', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property14.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property16.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Property17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property18.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Property19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property19.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Property20', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['property20.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 1); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['property20.py'], configOptions); - TestUtils.validateResults(analysisResults2, 1); -}); - -test('Property21', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['property21.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0, 0, 0, undefined, undefined, 2); - - configOptions.diagnosticRuleSet.reportDeprecated = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['property21.py'], configOptions); - TestUtils.validateResults(analysisResults2, 2); -}); - -test('Property22', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property22.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Property23', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.diagnosticRuleSet.reportIncompatibleMethodOverride = 'error'; - - // Override-compatibility checking is not yet performed for overloaded - // property accessors, so the incompatible setter override in this sample - // is intentionally not reported. Update this expectation when override - // support for overloaded accessors is added. - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['property23.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Operator2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Operator3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator5.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Operator6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Operator8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator8.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Operator9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator10.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Operator11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Operator12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['operator12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Optional1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Disable diagnostics. - configOptions.diagnosticRuleSet.reportOptionalSubscript = 'none'; - configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'none'; - configOptions.diagnosticRuleSet.reportOptionalCall = 'none'; - configOptions.diagnosticRuleSet.reportOptionalIterable = 'none'; - configOptions.diagnosticRuleSet.reportOptionalContextManager = 'none'; - configOptions.diagnosticRuleSet.reportOptionalOperand = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on warnings. - configOptions.diagnosticRuleSet.reportOptionalSubscript = 'warning'; - configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'warning'; - configOptions.diagnosticRuleSet.reportOptionalCall = 'warning'; - configOptions.diagnosticRuleSet.reportOptionalIterable = 'warning'; - configOptions.diagnosticRuleSet.reportOptionalContextManager = 'warning'; - configOptions.diagnosticRuleSet.reportOptionalOperand = 'warning'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions); - TestUtils.validateResults(analysisResults, 0, 8); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportOptionalSubscript = 'error'; - configOptions.diagnosticRuleSet.reportOptionalMemberAccess = 'error'; - configOptions.diagnosticRuleSet.reportOptionalCall = 'error'; - configOptions.diagnosticRuleSet.reportOptionalIterable = 'error'; - configOptions.diagnosticRuleSet.reportOptionalContextManager = 'error'; - configOptions.diagnosticRuleSet.reportOptionalOperand = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional1.py'], configOptions); - TestUtils.validateResults(analysisResults, 8); -}); - -test('Optional2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - // Disable diagnostics. - configOptions.diagnosticRuleSet.reportOptionalOperand = 'none'; - let analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional2.py'], configOptions); - TestUtils.validateResults(analysisResults, 0); - - // Turn on errors. - configOptions.diagnosticRuleSet.reportOptionalOperand = 'error'; - analysisResults = TestUtils.typeAnalyzeSampleFiles(['optional2.py'], configOptions); - TestUtils.validateResults(analysisResults, 1); -}); - -test('Tuple1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple1.py']); - - TestUtils.validateResults(analysisResults, 27); -}); - -test('Tuple2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple2.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Tuple3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple3.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Tuple4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple5.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Tuple6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple6.py']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('Tuple7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple7.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Tuple8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple8.py']); - - TestUtils.validateResults(analysisResults, 11); -}); - -test('Tuple9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple9.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Tuple10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple10.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple11.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Tuple12', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple12.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple13', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple13.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple15', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple15.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple16', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple16.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple17', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple17.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Tuple18', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple18.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Tuple19', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tuple19.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NamedTuple1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple1.py']); - - TestUtils.validateResults(analysisResults, 13); -}); - -test('NamedTuple2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple2.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('NamedTuple3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NamedTuple4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NamedTuple5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NamedTuple6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple6.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('NamedTuple7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NamedTuple8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('NamedTuple9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple9.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('NamedTuple10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple10.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('NamedTuple11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['namedTuple11.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('NamedTuple12', () => { - const configOptions = new ConfigOptions(Uri.empty()); - configOptions.defaultPythonVersion = pythonVersion3_12; - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['matchNamedTupleGeneric1.py'], configOptions); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Slots1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots1.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Slots2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots2.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Slots3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Slots4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['slots4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Parameters1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportMissingParameterType = 'none'; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['parameters1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportMissingParameterType = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['parameters1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 1); -}); - -test('Self1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self1.py']); - - TestUtils.validateResults(analysisResults, 15); -}); - -test('Self2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self2.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('Self3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self6.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Self8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self8.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self9', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self9.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Self10', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self10.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Self11', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['self11.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('UnusedVariable1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.diagnosticRuleSet.reportUnusedVariable = 'none'; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['unusedVariable1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 0); - - configOptions.diagnosticRuleSet.reportUnusedVariable = 'error'; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['unusedVariable1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 3); -}); - -test('Descriptor1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor1.py']); - - TestUtils.validateResults(analysisResults, 6); -}); - -test('Descriptor2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Descriptor3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Descriptor4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['descriptor4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Partial1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial1.py']); - - TestUtils.validateResults(analysisResults, 18); -}); - -test('Partial2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Partial3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Partial4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial4.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Partial5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial5.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Partial6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial6.py']); - - TestUtils.validateResults(analysisResults, 2); -}); - -test('Partial7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Partial8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['partial8.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TotalOrdering1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['totalOrdering1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('StructUnpack1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['structUnpack1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TupleUnpack1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack1.py']); - - TestUtils.validateResults(analysisResults, 5); -}); - -test('TupleUnpack2', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_10; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack2.py'], configOptions); - TestUtils.validateResults(analysisResults1, 18); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack2.py'], configOptions); - TestUtils.validateResults(analysisResults2, 4); -}); - -test('TupleUnpack3', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_11; - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack3.py'], configOptions); - TestUtils.validateResults(analysisResults1, 1); -}); - -test('TupleUnpack4', () => { - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack4.py']); - TestUtils.validateResults(analysisResults1, 2); -}); - -test('TupleUnpack5', () => { - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['tupleUnpack5.py']); - TestUtils.validateResults(analysisResults1, 0); -}); - -test('PseudoGeneric1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('PseudoGeneric2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('PseudoGeneric3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['pseudoGeneric3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Strings2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['strings2.py']); - - TestUtils.validateResults(analysisResults, 2, 1); -}); - -test('LiteralString1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString1.py']); - - TestUtils.validateResults(analysisResults, 10); -}); - -test('LiteralString2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('LiteralString3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['literalString3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ParamInference1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramInference1.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('ParamInference2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['paramInference2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('Dictionary1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary1.py']); - - TestUtils.validateResults(analysisResults, 3); -}); - -test('Dictionary2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary2.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Dictionary3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary3.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('Dictionary4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['dictionary4.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('StaticExpression1', () => { - const configOptions = new ConfigOptions(Uri.empty()); - - configOptions.defaultPythonVersion = pythonVersion3_8; - configOptions.defaultPythonPlatform = 'windows'; - - const analysisResults1 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults1, 9); - - configOptions.defaultPythonVersion = pythonVersion3_11; - configOptions.defaultPythonPlatform = 'Linux'; - - const analysisResults2 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults2, 6); - - configOptions.defineConstant.set('DEFINED_TRUE', true); - configOptions.defineConstant.set('DEFINED_FALSE', false); - configOptions.defineConstant.set('DEFINED_STR', 'hi!'); - const analysisResults3 = TestUtils.typeAnalyzeSampleFiles(['staticExpression1.py'], configOptions); - TestUtils.validateResults(analysisResults3, 0); -}); - -test('StaticExpression2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['staticExpression2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('StaticExpressionLiteral1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['staticExpressionLiteral1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('SpecialForm1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('SpecialForm2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('SpecialForm3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm3.py']); - - TestUtils.validateResults(analysisResults, 22); -}); - -test('SpecialForm4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['specialForm4.py']); - - TestUtils.validateResults(analysisResults, 72); -}); - -// TypeForm support is enabled by default and no longer requires -// enableExperimentalFeatures, so these tests intentionally leave it off. - -test('TypeForm1', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm1.py']); - - TestUtils.validateResults(analysisResults, 4); -}); - -test('TypeForm2', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm2.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeForm3', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm3.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeForm4', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm4.py']); - - TestUtils.validateResults(analysisResults, 27); -}); - -test('TypeForm5', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm5.py']); - - TestUtils.validateResults(analysisResults, 0); -}); - -test('TypeForm6', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm6.py']); - - TestUtils.validateResults(analysisResults, 8); -}); - -test('TypeForm7', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm7.py']); - - TestUtils.validateResults(analysisResults, 1); -}); - -test('TypeForm8', () => { - const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeForm8.py']); - - TestUtils.validateResults(analysisResults, 2); -}); diff --git a/packages/vipeye-internal/src/tests/uri.test.ts b/packages/vipeye-internal/src/tests/uri.test.ts index 523d18ba..55b6f40b 100644 --- a/packages/vipeye-internal/src/tests/uri.test.ts +++ b/packages/vipeye-internal/src/tests/uri.test.ts @@ -331,24 +331,24 @@ test('init and pytyped', () => { const uri2 = uri.pytypedUri; assert.equal(uri2.toString(), 'file:///a/b/c/py.typed'); const uri3 = uri.initPyUri; - assert.equal(uri3.toString(), 'file:///a/b/c/__init__.py'); + assert.equal(uri3.toString(), 'file:///a/b/c/__init__.vp'); const uri4 = uri.initPyiUri; - assert.equal(uri4.toString(), 'file:///a/b/c/__init__.pyi'); + assert.equal(uri4.toString(), 'file:///a/b/c/__init__.vpi'); const uri5 = uri.packageUri; - assert.equal(uri5.toString(), 'file:///a/b/c.py'); + assert.equal(uri5.toString(), 'file:///a/b/c.vp'); const uri6 = uri.packageStubUri; - assert.equal(uri6.toString(), 'file:///a/b/c.pyi'); + assert.equal(uri6.toString(), 'file:///a/b/c.vpi'); const uri7 = Uri.parse('foo://microsoft.com/a/b/c.py', caseDetector); const uri8 = uri7.pytypedUri; assert.equal(uri8.toString(), 'foo://microsoft.com/a/b/c.py/py.typed'); const uri9 = uri7.initPyUri; - assert.equal(uri9.toString(), 'foo://microsoft.com/a/b/c.py/__init__.py'); + assert.equal(uri9.toString(), 'foo://microsoft.com/a/b/c.py/__init__.vp'); const uri10 = uri7.initPyiUri; - assert.equal(uri10.toString(), 'foo://microsoft.com/a/b/c.py/__init__.pyi'); + assert.equal(uri10.toString(), 'foo://microsoft.com/a/b/c.py/__init__.vpi'); const uri11 = uri7.packageUri; - assert.equal(uri11.toString(), 'foo://microsoft.com/a/b/c.py.py'); + assert.equal(uri11.toString(), 'foo://microsoft.com/a/b/c.py.vp'); const uri12 = uri7.packageStubUri; - assert.equal(uri12.toString(), 'foo://microsoft.com/a/b/c.py.pyi'); + assert.equal(uri12.toString(), 'foo://microsoft.com/a/b/c.py.vpi'); }); test('isChild', () => {