public void HasImportReturnsTrueForImportedAsName() { string code = "import sys as something"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); Assert.IsTrue(resolverContext.HasImport("something")); }
public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnitWithSingleUsingWithMultipleNamespaces() { string code = "import abc, ghi"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); Assert.IsTrue(resolverContext.HasImport("ghi")); }
public void HasImportReturnsFalseForFromImport() { string code = "from import sys"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); Assert.IsFalse(resolverContext.HasImport("sys")); }
public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnit() { string code = "import abc"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); Assert.IsTrue(resolverContext.HasImport("abc")); }